Is this right?
validates_uniqueness_of :email, :message => "Email taken", :unless => :email == 'info@mysite.com'
Is this right?
validates_uniqueness_of :email, :message => "Email taken", :unless => :email == 'info@mysite.com'
Is this right?
validates_uniqueness_of :email, :message => "Email taken", :unless => :email == 'i...@mysite.com'
no. :unless must be the name of a method that returns whether or not to run the validation
Fred
Frederick Cheung wrote: >> Is this right?
>> validates_uniqueness_of :email, :message => "Email taken", :unless => >> :email == 'i...@mysite.com'
> no. :unless must be the name of a method that returns whether or not > to run the validation
> Fred
How would I write a condition that doesn't check the uniqueness of a mail address if the address is 'i...@mysite.com'
you write a method that returns true if the email is that magic value
Fred
Frederick Cheung wrote:
validates_uniqueness_of :email, :message => "Email taken", :unless => "email == 'i...@mysite.com'"
Samer Abukhait wrote:
validates_uniqueness_of :email, :message => "Email taken", :unless => "email == 'i...@mysite.com'"
Nope.
Best,
Unless I am severely mistaken, you can't use :unless as a condition in the validation anyway. It would need to be :if => some_condition, where the some_condition method would return true/false.
Billee D. wrote:
Unless I am severely mistaken, you can't use :unless as a condition in the validation anyway. It would need to be :if => some_condition, where the some_condition method would return true/false.
On Aug 17, 1:22�pm, P�l Bergstr�m <rails-mailing-l...@andreas-s.net>
It worked with :unless, as described in the API.