diff options
author | Durran Jordan <durran@gmail.com> | 2011-04-05 11:01:04 +0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-04-05 10:38:54 -0300 |
commit | a9b4b5da7c216e4464eeb9dbd0a39ea258d64325 (patch) | |
tree | 5af4723bd3ce6d4351d1c10b49e2f54b58c18731 /activerecord/lib | |
parent | 284ca810c17a89d15d809ba203289487044fcff9 (diff) | |
download | rails-a9b4b5da7c216e4464eeb9dbd0a39ea258d64325.tar.gz rails-a9b4b5da7c216e4464eeb9dbd0a39ea258d64325.tar.bz2 rails-a9b4b5da7c216e4464eeb9dbd0a39ea258d64325.zip |
Destroying records via nested attributes works independent of reject_if:
- When a :_destroy truthiness is provided in the attributes hash, the
record should get destroyed regardless of the result of the proc or
method supplied to :reject_if. (If :allow_destroy is true)
[#6006 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 522c0cfc9f..c111a968dc 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -452,6 +452,7 @@ module ActiveRecord end def call_reject_if(association_name, attributes) + return false if has_destroy_flag?(attributes) case callback = self.nested_attributes_options[association_name][:reject_if] when Symbol method(callback).arity == 0 ? send(callback) : send(callback, attributes) |