diff options
author | Ernie Miller <ernie@metautonomo.us> | 2011-08-20 13:00:26 -0400 |
---|---|---|
committer | Ernie Miller <ernie@metautonomo.us> | 2011-08-20 13:00:26 -0400 |
commit | e2ae015952c5bdcca044504b5be1c13a518eeaac (patch) | |
tree | e6be33f99ba8e70c723187bc8c05e0490f00c417 /activerecord/lib | |
parent | 8bd76aa50ec5dc5da3c398a0fd5dc971f64d8d68 (diff) | |
download | rails-e2ae015952c5bdcca044504b5be1c13a518eeaac.tar.gz rails-e2ae015952c5bdcca044504b5be1c13a518eeaac.tar.bz2 rails-e2ae015952c5bdcca044504b5be1c13a518eeaac.zip |
Fix assumption of primary key name in PredicateBuilder subquery.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 2814771002..dc8667b5cd 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -19,7 +19,7 @@ module ActiveRecord case value when ActiveRecord::Relation - value.select_values = [value.klass.arel_table['id']] if value.select_values.empty? + value.select_values = [value.klass.arel_table[value.klass.primary_key]] if value.select_values.empty? attribute.in(value.arel.ast) when Array, ActiveRecord::Associations::CollectionProxy values = value.to_a.map { |x| |