diff options
author | Alexey Vakhov <vakhov@gmail.com> | 2012-03-09 15:18:16 +0400 |
---|---|---|
committer | Alexey Vakhov <vakhov@gmail.com> | 2012-03-09 15:21:12 +0400 |
commit | 48a7df9a9f039ecb6466d51c651e4bc624077cf4 (patch) | |
tree | cd72178f71a630467af8bb8fbb4315649dcc963a /activerecord/lib/active_record/associations | |
parent | 225eff9d61d2bcea5cbe8c30a03f404fab239f18 (diff) | |
download | rails-48a7df9a9f039ecb6466d51c651e4bc624077cf4.tar.gz rails-48a7df9a9f039ecb6466d51c651e4bc624077cf4.tar.bz2 rails-48a7df9a9f039ecb6466d51c651e4bc624077cf4.zip |
In AR depths use &:to_i before :uniq to process mixed arrays likes ["1", 1] correct
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index b2136605e1..da4c311bce 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -544,7 +544,7 @@ module ActiveRecord # If using a custom finder_sql, #find scans the entire collection. def find_by_scan(*args) expects_array = args.first.kind_of?(Array) - ids = args.flatten.compact.uniq.map { |arg| arg.to_i } + ids = args.flatten.compact.map{ |arg| arg.to_i }.uniq if ids.size == 1 id = ids.first |