diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-06 17:48:11 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-09 16:32:54 -0300 |
commit | b4b8c26b6e3568525b974889e60bfd2a025f0114 (patch) | |
tree | 32cc90e8215bbd051d7e25c38bd4e08f97df8cec /railties/test | |
parent | 95b7b02d127d66fb7861de69a1786095e64b971f (diff) | |
download | rails-b4b8c26b6e3568525b974889e60bfd2a025f0114.tar.gz rails-b4b8c26b6e3568525b974889e60bfd2a025f0114.tar.bz2 rails-b4b8c26b6e3568525b974889e60bfd2a025f0114.zip |
Use the references and belongs_id ids in the scaffold_controller
generator
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/scaffold_controller_generator_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb index 0498c4c3fd..f467043cd0 100644 --- a/railties/test/generators/scaffold_controller_generator_test.rb +++ b/railties/test/generators/scaffold_controller_generator_test.rb @@ -61,6 +61,15 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase end end + def test_controller_permit_references_attributes + run_generator ["LineItem", "product:references", "cart:belongs_to"] + + assert_file "app/controllers/line_items_controller.rb" do |content| + assert_match(/def line_item_params/, content) + assert_match(/params\.require\(:line_item\)\.permit\(:product_id, :cart_id\)/, content) + end + end + def test_helper_are_invoked_with_a_pluralized_name run_generator assert_file "app/helpers/users_helper.rb", /module UsersHelper/ |