rails-routes-js-utils 1.2.0 → 1.2.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.
@@ -32,6 +32,7 @@ module Rails
32
32
 
33
33
  def self.generate
34
34
  all_routes = ENV['CONTROLLER'] ? Rails.Application.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : Rails.application.routes
35
+ last_name = nil
35
36
  all_routes.routes.collect do |route|
36
37
  compiled_regex = route.path.to_regexp.to_javascript
37
38
 
@@ -50,8 +51,13 @@ module Rails
50
51
  if compiled_verb == '//'
51
52
  compiled_verb = '/.*/'
52
53
  end
53
- if route.name
54
- "addRouteToEnv({name: '#{route.name}', path: #{compiled_regex}, subdomain: #{subdomain_regex} , reqs: #{reqs.to_json}, replace: function(opts) { return #{js.join('+')}; }, verb: #{compiled_verb} });"
54
+ name = route.name
55
+ if !name && last_name
56
+ name = last_name
57
+ end
58
+ if name
59
+ last_name = name
60
+ "addRouteToEnv({name: '#{name}', path: #{compiled_regex}, subdomain: #{subdomain_regex} , reqs: #{reqs.to_json}, replace: function(opts) { return #{js.join('+')}; }, verb: #{compiled_verb} });"
55
61
  end
56
62
  end.join("\n");
57
63
  end
@@ -2,7 +2,7 @@ module Rails
2
2
  module Routes
3
3
  module Js
4
4
  module Utils
5
- VERSION = "1.2.0"
5
+ VERSION = "1.2.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.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: