提交 8fe9b43b 编写于 作者: W Wojciech Wnętrzak

Fixed generating namespaced table_name_prefix in engines

上级 f874b155
<% 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 -%>
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册