Permalink
Browse files

wrap the literal value before handing it to arel

this lets arel know how to correctly quote the value
  • Loading branch information...
1 parent 426ae86 commit a38e957f8021bbd9a2fa2fc9f5bcea9d9ba6e7ef @tenderlove tenderlove committed Apr 8, 2014
View
7 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -324,13 +324,14 @@ def rollback_to_savepoint(name = nil)
def release_savepoint(name = nil)
end
- def case_sensitive_modifier(node)
+ def case_sensitive_modifier(node, table_attribute)
node
end
def case_sensitive_comparison(table, attribute, column, value)
- value = case_sensitive_modifier(value) unless value.nil?
- table[attribute].eq(value)
+ table_attr = table[attribute]
+ value = case_sensitive_modifier(value, table_attr) unless value.nil?
+ table_attr.eq(value)
end
def case_insensitive_comparison(table, attribute, column, value)
View
3 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -610,7 +610,8 @@ def primary_key(table)
pk_and_sequence && pk_and_sequence.first
end
- def case_sensitive_modifier(node)
+ def case_sensitive_modifier(node, table_attribute)
+ node = Arel::Nodes.build_quoted node, table_attribute
Arel::Nodes::Bin.new(node)
end

0 comments on commit a38e957

Please sign in to comment.