diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-09 20:21:58 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-09 20:21:58 -0300 |
commit | e1175d99e2c2813b248475fd0234818cd3b3e386 (patch) | |
tree | d98e6c750d2aa01d524782cdc763d105a3a487cb /activerecord/lib/active_record/associations/association.rb | |
parent | 32b6873d0899ab185bc862db09c18fcaed88bdb3 (diff) | |
parent | 5a0b184c53bf649930b153f3c39c542eca25d74a (diff) | |
download | rails-e1175d99e2c2813b248475fd0234818cd3b3e386.tar.gz rails-e1175d99e2c2813b248475fd0234818cd3b3e386.tar.bz2 rails-e1175d99e2c2813b248475fd0234818cd3b3e386.zip |
Merge pull request #15596 from eileencodes/add-has_one-method-and-reuse
add has_one? method and reuse instead of checking macro
Diffstat (limited to 'activerecord/lib/active_record/associations/association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 4a04303fb8..89cbb50035 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -179,7 +179,7 @@ module ActiveRecord def creation_attributes attributes = {} - if (reflection.macro == :has_one || reflection.macro == :has_many) && !options[:through] + if (reflection.has_one? || reflection.macro == :has_many) && !options[:through] attributes[reflection.foreign_key] = owner[reflection.active_record_primary_key] if reflection.options[:as] |