From ed99dda174da439a0947cdabea3babf027c672ac Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Thu, 10 Apr 2008 18:06:05 +0000 Subject: Change validates_uniqueness_of :case_sensitive option default back to true (from [9160]). Love your database columns, don't LOWER them. [rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9248 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 2 ++ activerecord/lib/active_record/validations.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 76d76cb0dd..e79487c687 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Change validates_uniqueness_of :case_sensitive option default back to true (from [9160]). Love your database columns, don't LOWER them. [rick] + * Ensure that save on child object fails for invalid belongs_to association. Closes #11555. [rubyruy] * Add support for interleaving migrations by storing which migrations have run in the new schema_migrations table. Closes #11493 [jordi] diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index bd1c67cd84..86cda9aa66 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -603,7 +603,7 @@ module ActiveRecord # Configuration options: # * message - Specifies a custom error message (default is: "has already been taken") # * scope - One or more columns by which to limit the scope of the uniqueness constraint. - # * case_sensitive - Looks for an exact match. Ignored by non-text columns (false by default). + # * case_sensitive - Looks for an exact match. Ignored by non-text columns (true by default). # * allow_nil - If set to true, skips this validation if the attribute is null (default is: false) # * allow_blank - If set to true, skips this validation if the attribute is blank (default is: false) # * if - Specifies a method, proc or string to call to determine if the validation should @@ -613,7 +613,7 @@ module ActiveRecord # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The # method, proc or string should return or evaluate to a true or false value. def validates_uniqueness_of(*attr_names) - configuration = { :message => ActiveRecord::Errors.default_error_messages[:taken] } + configuration = { :message => ActiveRecord::Errors.default_error_messages[:taken], :case_sensitive => true } configuration.update(attr_names.extract_options!) validates_each(attr_names,configuration) do |record, attr_name, value| -- cgit v1.2.3