diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index 5fc3386e..851ab8c4 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -1,3 +1,6 @@ +* bug fix + * Give scope to the proper model validation + * enhancements * Do not care about blank passwords on update * Mail views are scoped as well diff --git a/lib/devise/models/validatable.rb b/lib/devise/models/validatable.rb index 391dd4a1..2a6d931e 100644 --- a/lib/devise/models/validatable.rb +++ b/lib/devise/models/validatable.rb @@ -19,9 +19,8 @@ module Devise base.class_eval do validates_presence_of :email - validates_uniqueness_of :email, :allow_blank => true - validates_format_of :email, :with => EMAIL_REGEX, :allow_blank => true, - :scope => authentication_keys[1..-1] + validates_uniqueness_of :email, :scope => authentication_keys[1..-1], :allow_blank => true + validates_format_of :email, :with => EMAIL_REGEX, :allow_blank => true with_options :if => :password_required? do |v| v.validates_presence_of :password