diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index f07a4aa674..b9e916078c 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -579,14 +579,15 @@ module ActionDispatch raise "A rack application must be specified" unless path - options[:as] ||= app_name(app) + rails_app = rails_app? app + options[:as] ||= app_name(app, rails_app) target_as = name_for_action(options[:as], path) options[:via] ||= :all match(path, options.merge(:to => app, :anchor => false, :format => false)) - define_generate_prefix(app, target_as) if rails_app?(app) + define_generate_prefix(app, target_as) if rails_app self end @@ -611,10 +612,11 @@ module ActionDispatch app.is_a?(Class) && app < Rails::Railtie end - def app_name(app) - if rails_app?(app) + def app_name(app, rails_app) + if rails_app app.railtie_name - elsif class_name = app.try(:name) + elsif app.is_a?(Class) + class_name = app.name ActiveSupport::Inflector.underscore(class_name).tr("/", "_") end end |