Hi, I was writing some tests when I discovered (god bless testing...) that my User model, that use Devise, doesn''t validate the presence of the :password_confirmation field. I was expecting that adding :validatable to the Devise option would include the presence validation for this field too. Could any one please explain this behaviour? There is a better solution than simply adding that field to User model validation? thank you. bye, enricostn -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/J_r2Hs92FgsJ. For more options, visit https://groups.google.com/groups/opt_out.
Norbert Melzer
2012-Sep-28 19:39 UTC
Re: devise validatable and password_confirmation presence
Can''t follow you… all the confirmation-fields you probably have, don''t need to be checked if they are present… That''s throwing away CPU cycles and therefore money! It is simple logic: When all validations pass on the original field they will also pass on the corresponding confirmation field, as long as it has the same value as the original field. So do all necessary validations on your original field, check if it is identical with the confirmation field and you are done… 2012/9/28 enrico stano <enricostn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Hi, > > I was writing some tests when I discovered (god bless testing...) that my > User model, that use Devise, doesn''t validate the presence of the > :password_confirmation field. > > I was expecting that adding :validatable to the Devise option would include > the presence validation for this field too. > > Could any one please explain this behaviour? > > There is a better solution than simply adding that field to User model > validation? > > thank you. > > bye, > > enricostn > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/J_r2Hs92FgsJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
enrico stano
2012-Sep-28 19:45 UTC
Re: devise validatable and password_confirmation presence
Ok I got it. You''re probably right. The validation for the confirmation field it''s related to the comparation with the original field. Thanks 2012/9/28 Norbert Melzer <timmelzer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Can''t follow you… all the confirmation-fields you probably have, don''t > need to be checked if they are present… That''s throwing away CPU > cycles and therefore money! > > It is simple logic: > > When all validations pass on the original field they will also pass on > the corresponding confirmation field, as long as it has the same value > as the original field. So do all necessary validations on your > original field, check if it is identical with the confirmation field > and you are done… > > 2012/9/28 enrico stano <enricostn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >> Hi, >> >> I was writing some tests when I discovered (god bless testing...) that my >> User model, that use Devise, doesn''t validate the presence of the >> :password_confirmation field. >> >> I was expecting that adding :validatable to the Devise option would include >> the presence validation for this field too. >> >> Could any one please explain this behaviour? >> >> There is a better solution than simply adding that field to User model >> validation? >> >> thank you. >> >> bye, >> >> enricostn >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/J_r2Hs92FgsJ. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- · Enrico Stano · · twitter @enricostano · skype ocirneonats -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.