From 5ad79989ef0a015fd22cfed90b2e8a56881e6c36 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 10 Aug 2012 12:33:51 +0100 Subject: Remove the dependent_restrict_raises option. It's not really a good idea to have this as a global config option. We should allow people to specify the behaviour per association. There will now be two new values: * :dependent => :restrict_with_exception implements the current behaviour of :restrict. :restrict itself is deprecated in favour of :restrict_with_exception. * :dependent => :restrict_with_error implements the new behaviour - it adds an error to the owner if there are dependent records present See #4727 for the original discussion of this. --- .../lib/rails/generators/rails/app/templates/config/application.rb | 5 ----- railties/test/generators/app_generator_test.rb | 5 ----- 2 files changed, 10 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index f20dd78031..a952ff7fb0 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -56,11 +56,6 @@ module <%= app_const_base %> # in your app. As such, your models will need to explicitly whitelist or blacklist accessible # parameters by using an attr_accessible or attr_protected declaration. <%= comment_if :skip_active_record %>config.active_record.whitelist_attributes = true - - # Specifies whether or not has_many or has_one association option :dependent => :restrict raises - # an exception. If set to true, then an ActiveRecord::DeleteRestrictionError exception would be - # raised. If set to false, then an error will be added on the model instead. - <%= comment_if :skip_active_record %>config.active_record.dependent_restrict_raises = false <% unless options.skip_sprockets? -%> # Enable the asset pipeline. diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 907065f75c..0924d26041 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -367,11 +367,6 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "config/application.rb", /config\.active_record\.whitelist_attributes = true/ end - def test_active_record_dependent_restrict_raises_is_present_application_config - run_generator - assert_file "config/application.rb", /config\.active_record\.dependent_restrict_raises = false/ - end - def test_pretend_option output = run_generator [File.join(destination_root, "myapp"), "--pretend"] assert_no_match(/run bundle install/, output) -- cgit v1.2.3