diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-16 19:53:40 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-16 13:43:54 -0800 |
commit | c4458b36024a20abacc39c069444bb0ac202778a (patch) | |
tree | 82d4e8a3c14e4759a9fa27d1e5b9fed84613e6ef /activerecord | |
parent | 8aedd722e119770908eb3956ad91f4c88f425eb5 (diff) | |
download | rails-c4458b36024a20abacc39c069444bb0ac202778a.tar.gz rails-c4458b36024a20abacc39c069444bb0ac202778a.tar.bz2 rails-c4458b36024a20abacc39c069444bb0ac202778a.zip |
Rename some variables
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/has_one_through_association.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_through_association.rb b/activerecord/lib/active_record/associations/has_one_through_association.rb index 6c455c8716..dcd74e7346 100644 --- a/activerecord/lib/active_record/associations/has_one_through_association.rb +++ b/activerecord/lib/active_record/associations/has_one_through_association.rb @@ -11,21 +11,21 @@ module ActiveRecord private - def create_through_record(new_value) - proxy = @owner.send(:association_proxy, @reflection.through_reflection.name) - record = proxy.send(:load_target) + def create_through_record(record) + through_proxy = @owner.send(:association_proxy, @reflection.through_reflection.name) + through_record = through_proxy.send(:load_target) - if record && !new_value - record.destroy - elsif new_value - attributes = construct_join_attributes(new_value) + if through_record && !record + through_record.destroy + elsif record + attributes = construct_join_attributes(record) - if record - record.update_attributes(attributes) + if through_record + through_record.update_attributes(attributes) elsif @owner.new_record? - proxy.build(attributes) + through_proxy.build(attributes) else - proxy.create(attributes) + through_proxy.create(attributes) end end end |