aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/finder_methods.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-02-27 10:57:40 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-02-27 11:13:56 -0800
commit4bc2ae0da1dd812aee759f6d13ad428354cd0e13 (patch)
treeab5609062d04dc1ba43b1449c9f3009356b6cea7 /activerecord/lib/active_record/relation/finder_methods.rb
parenta4e4d2855bbad1c1400fb89ba663f7193d76dc10 (diff)
downloadrails-4bc2ae0da1dd812aee759f6d13ad428354cd0e13.tar.gz
rails-4bc2ae0da1dd812aee759f6d13ad428354cd0e13.tar.bz2
rails-4bc2ae0da1dd812aee759f6d13ad428354cd0e13.zip
use bind values for join columns
Diffstat (limited to 'activerecord/lib/active_record/relation/finder_methods.rb')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index 26a5165abf..4cd703e0a5 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -200,7 +200,7 @@ module ActiveRecord
relation = relation.where(table[primary_key].eq(id)) if id
end
- connection.select_value(relation, "#{name} Exists") ? true : false
+ connection.select_value(relation, "#{name} Exists", relation.bind_values) ? true : false
end
protected
@@ -331,7 +331,7 @@ module ActiveRecord
substitute = connection.substitute_at(column, @bind_values.length)
relation = where(table[primary_key].eq(substitute))
- relation.bind_values = [[column, id]]
+ relation.bind_values += [[column, id]]
record = relation.first
unless record