diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 96c49a81bb..dd18588b39 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -356,8 +356,12 @@ module Rails @app_name ||= File.basename(destination_root) end + def defined_app_const_base + Rails.application.class.name.sub(/::Application$/, "") if Rails.application.instance_of?(Rails::Application) + end + def app_const_base - @app_const_base ||= app_name.gsub(/\W/, '_').squeeze('_').camelize + @app_const_base ||= defined_app_const_base || app_name.gsub(/\W/, '_').squeeze('_').camelize end def app_const |