diff options
author | José Valim <jose.valim@gmail.com> | 2011-11-23 20:43:06 +0000 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-11-23 20:43:06 +0000 |
commit | e62de52aa398341a29b7ecef4ec9f9df8e1743e2 (patch) | |
tree | 3a87677e000259ecc0ced6bc93afc03fea73493b /activerecord/lib/active_record/nested_attributes.rb | |
parent | afd7140b66e7cb32e1be58d9e44489e6bcbde0dc (diff) | |
parent | fd86a1b6b068df87164d5763bdcd4a323a1e76f4 (diff) | |
download | rails-e62de52aa398341a29b7ecef4ec9f9df8e1743e2.tar.gz rails-e62de52aa398341a29b7ecef4ec9f9df8e1743e2.tar.bz2 rails-e62de52aa398341a29b7ecef4ec9f9df8e1743e2.zip |
Merge branch 'master' into serializers
Diffstat (limited to 'activerecord/lib/active_record/nested_attributes.rb')
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 2dbebfcaf8..d2065d701f 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -220,7 +220,7 @@ module ActiveRecord # validates_presence_of :member # end module ClassMethods - REJECT_ALL_BLANK_PROC = proc { |attributes| attributes.all? { |_, value| value.blank? } } + REJECT_ALL_BLANK_PROC = proc { |attributes| attributes.all? { |key, value| key == '_destroy' || value.blank? } } # Defines an attributes writer for the specified association(s). If you # are using <tt>attr_protected</tt> or <tt>attr_accessible</tt>, then you @@ -239,7 +239,8 @@ module ActiveRecord # is specified, a record will be built for all attribute hashes that # do not have a <tt>_destroy</tt> value that evaluates to true. # Passing <tt>:all_blank</tt> instead of a Proc will create a proc - # that will reject a record where all the attributes are blank. + # that will reject a record where all the attributes are blank excluding + # any value for _destroy. # [:limit] # Allows you to specify the maximum number of the associated records that # can be processed with the nested attributes. If the size of the |