diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/named_base.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/namespaced_generators_test.rb | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index 6db294290a..a1d39987e4 100644 --- a/railties/lib/rails/generators/named_base.rb +++ b/railties/lib/rails/generators/named_base.rb @@ -66,7 +66,11 @@ module Rails end def class_path - inside_namespace? || !namespaced? ? @class_path : namespaced_class_path + inside_namespace? || !namespaced? ? regular_class_path : namespaced_class_path + end + + def regular_class_path + @class_path end def namespaced_class_path diff --git a/railties/test/generators/namespaced_generators_test.rb b/railties/test/generators/namespaced_generators_test.rb index 2be5bea117..a4e93a4ecc 100644 --- a/railties/test/generators/namespaced_generators_test.rb +++ b/railties/test/generators/namespaced_generators_test.rb @@ -73,6 +73,11 @@ class NamespacedModelGeneratorTest < NamespacedGeneratorTestCase arguments %w(Account name:string age:integer) tests Rails::Generators::ModelGenerator + def test_module_file_is_not_created + run_generator + assert_no_file "app/models/test_app.rb" + end + def test_adds_namespace_to_model run_generator assert_file "app/models/test_app/account.rb", /module TestApp/, / class Account < ActiveRecord::Base/ |