diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-11-20 07:46:56 +0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-24 01:36:59 +0800 |
commit | 9c161599ac1e37eedd56bece4d975dde8cdaa151 (patch) | |
tree | 0df8d07bf3aa0e4ab1199de891356f44b1214b86 /activerecord | |
parent | a9e963d51d262a0693f0b83508c40a250421f826 (diff) | |
download | rails-9c161599ac1e37eedd56bece4d975dde8cdaa151.tar.gz rails-9c161599ac1e37eedd56bece4d975dde8cdaa151.tar.bz2 rails-9c161599ac1e37eedd56bece4d975dde8cdaa151.zip |
Remove uneeded local var definition.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index f1d3eaed38..a2101a02eb 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -322,9 +322,8 @@ module ActiveRecord def assign_nested_attributes_for_one_to_one_association(association_name, attributes) options = self.nested_attributes_options[association_name] attributes = attributes.with_indifferent_access - check_existing_record = (options[:update_only] || !attributes['id'].blank?) - if check_existing_record && (record = send(association_name)) && + if (options[:update_only] || !attributes['id'].blank?) && (record = send(association_name)) && (options[:update_only] || record.id.to_s == attributes['id'].to_s) assign_to_or_mark_for_destruction(record, attributes, options[:allow_destroy]) unless call_reject_if(association_name, attributes) |