aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-19 14:14:24 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-19 15:19:43 -0700
commit40887135f6c4e7e9feee03b4dac791ec1d54b3c6 (patch)
tree9eada969dd536c75b9ed31efbff859b33cf43865 /activerecord/lib
parent76d7d957900d8fe297c027604ae5d8364b3389d6 (diff)
downloadrails-40887135f6c4e7e9feee03b4dac791ec1d54b3c6.tar.gz
rails-40887135f6c4e7e9feee03b4dac791ec1d54b3c6.tar.bz2
rails-40887135f6c4e7e9feee03b4dac791ec1d54b3c6.zip
Whether a column exists or not doesn't affect whether we can use binds
Looking through the blame, this logic used to be when we actually created the bind tuple. My guess is that `nil` couldn't be handled there at that time. It can, now.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 1c36d51cd8..0e50534d47 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -959,12 +959,9 @@ module ActiveRecord
def create_binds(opts)
bindable, non_binds = opts.partition do |column, value|
- case value
- when String, Integer, ActiveRecord::StatementCache::Substitute
- @klass.columns_hash.include? column.to_s
- else
- false
- end
+ value.is_a?(String) ||
+ value.is_a?(Integer) ||
+ value.is_a?(ActiveRecord::StatementCache::Substitute)
end
association_binds, non_binds = non_binds.partition do |column, value|