mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
adding a case_sensitive_modifier for forcing comparisons to be case sensitive
This commit is contained in:
parent
35b2715456
commit
c4fc396300
4 changed files with 15 additions and 0 deletions
|
@ -203,6 +203,10 @@ module ActiveRecord
|
|||
def release_savepoint
|
||||
end
|
||||
|
||||
def case_sensitive_modifier(node)
|
||||
node
|
||||
end
|
||||
|
||||
def current_savepoint_name
|
||||
"active_record_#{open_transactions}"
|
||||
end
|
||||
|
|
|
@ -528,6 +528,11 @@ module ActiveRecord
|
|||
def case_sensitive_equality_operator
|
||||
"= BINARY"
|
||||
end
|
||||
deprecate :case_sensitive_equality_operator
|
||||
|
||||
def case_sensitive_modifier(node)
|
||||
Arel::Nodes::Bin.new(node)
|
||||
end
|
||||
|
||||
def limited_update_conditions(where_sql, quoted_table_name, quoted_primary_key)
|
||||
where_sql
|
||||
|
|
|
@ -655,6 +655,11 @@ module ActiveRecord
|
|||
def case_sensitive_equality_operator
|
||||
"= BINARY"
|
||||
end
|
||||
deprecate :case_sensitive_equality_operator
|
||||
|
||||
def case_sensitive_modifier(node)
|
||||
Arel::Nodes::Bin.new(node)
|
||||
end
|
||||
|
||||
def limited_update_conditions(where_sql, quoted_table_name, quoted_primary_key)
|
||||
where_sql
|
||||
|
|
|
@ -59,6 +59,7 @@ module ActiveRecord
|
|||
if !options[:case_sensitive] && column.text?
|
||||
relation = table[attribute].matches(value)
|
||||
else
|
||||
value = klass.connection.case_sensitive_modifier(value)
|
||||
relation = table[attribute].eq(value)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue