Permalink
Browse files

Send :scope to the proper validation.

  • Loading branch information...
1 parent 01ca3e5 commit 436300928b75668d3dfcef58850a2492ad06acd4 @josevalim josevalim committed Dec 16, 2009
Showing with 5 additions and 3 deletions.
  1. +3 −0 CHANGELOG.rdoc
  2. +2 −3 lib/devise/models/validatable.rb
3 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
View
5 lib/devise/models/validatable.rb
@@ -19,9 +19,8 @@ def self.included(base)
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

0 comments on commit 4363009

Please sign in to comment.