Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed generating namespaced table_name_prefix in engines

  • Loading branch information...
commit 8fe9b43b3016f2c0e7afad8fc081bbf37f267226 1 parent f874b15
Wojciech Wnętrzak morgoth authored
2  activerecord/lib/rails/generators/active_record/model/templates/module.rb
View
@@ -1,7 +1,7 @@
<% module_namespacing do -%>
module <%= class_path.map(&:camelize).join('::') %>
def self.table_name_prefix
- '<%= class_path.join('_') %>_'
+ '<%= namespaced? ? namespaced_class_path.join('_') : class_path.join('_') %>_'
end
end
<% end -%>
2  railties/test/generators/namespaced_generators_test.rb
View
@@ -99,7 +99,7 @@ def test_model_with_namespace
run_generator ["admin/account"]
assert_file "app/models/test_app/admin.rb", /module TestApp/, /module Admin/
assert_file "app/models/test_app/admin.rb", /def self\.table_name_prefix/
- assert_file "app/models/test_app/admin.rb", /'admin_'/
+ assert_file "app/models/test_app/admin.rb", /'test_app_admin_'/
assert_file "app/models/test_app/admin/account.rb", /module TestApp/, /class Admin::Account < ActiveRecord::Base/
end
Please sign in to comment.
Something went wrong with that request. Please try again.