On Aug 5, 2014, at 2:44 AM, Ronald Fischer <li...@ruby-forum.com> wrote:
> lambda { > t=self.password_validation_required > self.password_validation_required=true > t > } > > or can this potentially lead to problems later on? > I would avoid that. Without looking at your whole code I can't really say the right way to do that. However, I recommend you take a look at devise. It's a little top-heavy but it's worth it once you get the hang of it. Also, if you don't want to actually use it, read the source code and see how they do it with password validation. > Finally, a syntax question: You are writing > > lambda { .... } > > I would have written > > -> { ... } You're right -- they are equivalent in Ruby 2.0 (and to make matters worse I actually switched between Ruby 1 and Ruby 2 syntax in the same line of code). Probably best to stick with the shorthand if you're using Ruby 2. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7685EEB7-3D84-4296-9178-9AB0AA3672FB%40datatravels.com. For more options, visit https://groups.google.com/d/optout.