Is this right? validates_uniqueness_of :email, :message => "Email taken", :unless => :email == ''info-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org'' -- Posted via http://www.ruby-forum.com/.
On Aug 17, 6:22 pm, Pål Bergström <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Is this right? > > validates_uniqueness_of :email, :message => "Email taken", :unless => > :email == ''i...-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org''no. :unless must be the name of a method that returns whether or not to run the validation Fred> -- > Posted viahttp://www.ruby-forum.com/.
Frederick Cheung wrote:> On Aug 17, 6:22�pm, P�l Bergstr�m <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> Is this right? >> >> validates_uniqueness_of :email, :message => "Email taken", :unless => >> :email == ''i...-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org'' > > no. :unless must be the name of a method that returns whether or not > to run the validation > > FredHow would I write a condition that doesn''t check the uniqueness of a mail address if the address is ''info-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org'' -- Posted via http://www.ruby-forum.com/.
On Aug 17, 6:33 pm, Pål Bergström <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Frederick Cheung wrote: > > On Aug 17, 6:22 pm, P l Bergstr m <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > >> Is this right? > > >> validates_uniqueness_of :email, :message => "Email taken", :unless => > >> :email == ''i...-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org'' > > > 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...-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org''you write a method that returns true if the email is that magic value Fred> -- > Posted viahttp://www.ruby-forum.com/.
Frederick Cheung wrote:> On Aug 17, 6:33�pm, P�l Bergstr�m <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> >> > Fred >> >> How would I write a condition that doesn''t check the uniqueness of a >> mail address if the address is ''i...-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org'' > > you write a method that returns true if the email is that magic value > > FredI see. Now I understand. :-) Thanks. -- Posted via http://www.ruby-forum.com/.
validates_uniqueness_of :email, :message => "Email taken", :unless => "email == ''i...-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org''"
Samer Abukhait wrote:> validates_uniqueness_of :email, :message => "Email taken", :unless => > "email == ''i...-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org''"Nope. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
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...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Is this right? > > validates_uniqueness_of :email, :message => "Email taken", :unless => > :email == ''i...-t1rxLZ7CIXjQT0dZR+AlfA@public.gmane.org'' > -- > Posted viahttp://www.ruby-forum.com/.
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...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>It worked with :unless, as described in the API. -- Posted via http://www.ruby-forum.com/.