aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-11-01 18:16:46 -0600
committerSean Griffin <sean@thoughtbot.com>2014-11-01 18:16:46 -0600
commit50e7c013c04544091f0081e495cacdd987f4d8e1 (patch)
tree5d27a824e62480cacc5d15c2219c0037bbc0af1f /activerecord/lib/active_record
parent3ba9d32c6cb7e288ae6473298673bf1f2797f846 (diff)
downloadrails-50e7c013c04544091f0081e495cacdd987f4d8e1.tar.gz
rails-50e7c013c04544091f0081e495cacdd987f4d8e1.tar.bz2
rails-50e7c013c04544091f0081e495cacdd987f4d8e1.zip
Don't duplicate predicate building logic in Relation finders
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index 145b7378cf..6dd932e530 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -446,10 +446,7 @@ module ActiveRecord
MSG
end
- column = columns_hash[primary_key]
- substitute = connection.substitute_at(column, bind_values.length)
- relation = where(table[primary_key].eq(substitute))
- relation.bind_values += [[column, id]]
+ relation = where(primary_key => id)
record = relation.take
raise_record_not_found_exception!(id, 0, 1) unless record
@@ -458,7 +455,7 @@ module ActiveRecord
end
def find_some(ids)
- result = where(table[primary_key].in(ids)).to_a
+ result = where(primary_key => ids).to_a
expected_size =
if limit_value && ids.size > limit_value