diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-09-06 17:14:07 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-09-06 17:14:07 -0700 |
commit | 6a91a3307ff6556225ab8717617074cea20222e0 (patch) | |
tree | 43598080eea7d8ebae994cba7ab0cd1b3e17f4e3 /activerecord/lib | |
parent | a9da99ee5fd73b6d52c6fb443b2443cdfb262d5f (diff) | |
download | rails-6a91a3307ff6556225ab8717617074cea20222e0.tar.gz rails-6a91a3307ff6556225ab8717617074cea20222e0.tar.bz2 rails-6a91a3307ff6556225ab8717617074cea20222e0.zip |
hm:t join tables may not have a primary key
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 607ed0da46..a3fcca8a27 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -125,7 +125,11 @@ module ActiveRecord end def foreign_key_present? - owner.attribute_present?(reflection.association_primary_key) + if reflection.klass.primary_key + owner.attribute_present?(reflection.association_primary_key) + else + false + end end end end |