rails-routes-js-utils 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,15 +34,17 @@ module Rails
34
34
  all_routes = ENV['CONTROLLER'] ? Rails.Application.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : IMuaSam::Application.routes
35
35
  all_routes.routes.collect do |route|
36
36
  compiled_regex = route.path.to_regexp.to_javascript
37
+
38
+ #route.defaults contains action and controller name
37
39
  reqs = route.defaults.merge(parts: route.parts)
38
40
  if route.constraints[:subdomain]
39
- reqs = reqs.merge(subdomain: route.constraints[:subdomain].to_javascript)
41
+ subdomain_regex = route.constraints[:subdomain].to_javascript
40
42
  end
41
43
 
42
44
  js = [];
43
45
  dig(route.path.spec,js)
44
46
  if route.name
45
- "addRouteToEnv({name: '#{route.name}', path: #{compiled_regex} , reqs: #{reqs.to_json}, replace: function(opts) { return #{js.join('+')}; } });"
47
+ "addRouteToEnv({name: '#{route.name}', path: #{compiled_regex}, subdomain: #{subdomain_regex} , reqs: #{reqs.to_json}, replace: function(opts) { return #{js.join('+')}; } });"
46
48
  end
47
49
  end.join("\n");
48
50
  end
@@ -2,7 +2,7 @@ module Rails
2
2
  module Routes
3
3
  module Js
4
4
  module Utils
5
- VERSION = "1.1.0"
5
+ VERSION = "1.1.1"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-routes-js-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: