Merge pull request #43501 from henrik/destroy-bang-in-scaffolds

Use safer 'destroy!' in controller scaffolds
This commit is contained in:
Rafael Mendonça França 2022-01-20 11:59:40 -05:00 committed by GitHub
commit cd974d5616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -73,7 +73,7 @@ module Rails
# DELETE destroy
def destroy
"#{name}.destroy"
"#{name}.destroy!"
end
end
end

View File

@ -51,7 +51,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
assert_instance_method :destroy, content do |m|
assert_match(/@product_line\.destroy/, m)
assert_match(/@product_line\.destroy!/, m)
end
assert_instance_method :set_product_line, content do |m|
@ -137,7 +137,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
assert_instance_method :destroy, content do |m|
assert_match(/@product_line\.destroy/, m)
assert_match(/@product_line\.destroy!/, m)
end
end
@ -254,7 +254,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
assert_instance_method :destroy, content do |m|
assert_match(/@admin_role\.destroy/, m)
assert_match(/@admin_role\.destroy!/, m)
end
assert_instance_method :set_admin_role, content do |m|