From bfccbc6df91a3c24bbf99262383c6f1e9069e1dd Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Mon, 26 Jul 2010 17:05:04 +0200 Subject: Add Rails::Railtie.railtie_name method to allow setting custom name for railtie --- actionpack/lib/action_dispatch/routing/mapper.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index ef1bee106a..b437d7a17d 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -277,8 +277,13 @@ module ActionDispatch private def app_name(app) return unless app.respond_to?(:routes) - class_name = app.class.is_a?(Class) ? app.name : app.class.name - ActiveSupport::Inflector.underscore(class_name).gsub("/", "_") + + if app.respond_to?(:railtie_name) + app.railtie_name + else + class_name = app.class.is_a?(Class) ? app.name : app.class.name + ActiveSupport::Inflector.underscore(class_name).gsub("/", "_") + end end def define_generate_prefix(app, name) -- cgit v1.2.3