Created
May 14, 2011 02:35
-
-
Save AquaGeek/971803 to your computer and use it in GitHub Desktop.
Rails Lighthouse ticket #6527
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -rc activerecord-2.3.5.before/lib/active_record/validations.rb activerecord-2.3.5/lib/active_record/validations.rb | |
*** activerecord-2.3.5.before/lib/active_record/validations.rb Fri Mar 4 14:38:15 2011 | |
--- activerecord-2.3.5/lib/active_record/validations.rb Fri Mar 4 14:50:45 2011 | |
*************** | |
*** 813,820 **** | |
if scope = configuration[:scope] | |
Array(scope).map do |scope_item| | |
scope_value = record.send(scope_item) | |
! condition_sql << " AND " << attribute_condition("#{record.class.quoted_table_name}.#{scope_item}", scope_value) | |
! condition_params << scope_value | |
end | |
end | |
--- 813,838 ---- | |
if scope = configuration[:scope] | |
Array(scope).map do |scope_item| | |
scope_value = record.send(scope_item) | |
! scope_column = finder_class.columns_hash[scope_item.to_s] | |
! | |
! if scope_value.nil? | |
! comparison_operator = "IS ?" | |
! elsif scope_column.text? | |
! comparison_operator = "#{connection.case_sensitive_equality_operator} ?" | |
! scope_value = scope_column.limit ? scope_value.to_s.mb_chars[0, scope_column.limit] : scope_value.to_s | |
! else | |
! comparison_operator = "= ?" | |
! end | |
! | |
! sql_attribute = "#{record.class.quoted_table_name}.#{connection.quote_column_name(scope_item)}" | |
! | |
! if scope_value.nil? || (configuration[:case_sensitive] || !scope_column.text?) | |
! condition_sql << " AND " << "#{sql_attribute} #{comparison_operator}" | |
! condition_params << scope_value | |
! else | |
! condition_sql << " AND " << "LOWER(#{sql_attribute}) #{comparison_operator}" | |
! condition_params << scope_value.mb_chars.downcase | |
! end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment