diff options
author | Emilio Tagua <miloops@gmail.com> | 2011-02-18 15:29:33 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2011-02-18 15:29:33 -0300 |
commit | 0b702ba3de42ed2ae8855843127f898102802b77 (patch) | |
tree | fc7d9b2fd78c3558dd978f3b67e5e58792551668 /activerecord/lib/active_record/relation/predicate_builder.rb | |
parent | 90a850aea4c2c04df22be0aaad1144468fcc8078 (diff) | |
parent | 1644663ba7f678d178deab2bf1629dc05626f85b (diff) | |
download | rails-0b702ba3de42ed2ae8855843127f898102802b77.tar.gz rails-0b702ba3de42ed2ae8855843127f898102802b77.tar.bz2 rails-0b702ba3de42ed2ae8855843127f898102802b77.zip |
Merge remote branch 'rails/master' into identity_map
Conflicts:
activerecord/lib/active_record/associations/association.rb
activerecord/lib/active_record/fixtures.rb
Diffstat (limited to 'activerecord/lib/active_record/relation/predicate_builder.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 61d9974570..9633fd3d82 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -18,7 +18,10 @@ module ActiveRecord attribute = table[column.to_sym] case value - when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation + when ActiveRecord::Relation + value.select_values = [value.klass.arel_table['id']] if value.select_values.empty? + attribute.in(value.arel.ast) + when Array, ActiveRecord::Associations::CollectionProxy values = value.to_a.map { |x| x.is_a?(ActiveRecord::Base) ? x.id : x } |