Yeah, I have tried both of them and even :name. Unfortunately the ans is no.
How does validates work then ? Regards, On Wed, Feb 23, 2011 at 9:54 PM, Walter Lee Davis <wa...@wdstudio.com>wrote: > > On Feb 23, 2011, at 11:03 AM, Bhasker Harihara wrote: > > This is what I have and it gives the error. >> >> validates :uname, :presence => true, >> :length => { :maximum => 50 } >> >> puts "The name is set to #{user.uname}" >> >> But without the puts it updates the record into the databse. I think it >> is to do with scoping. If have this puts after make salt then I have no >> problem >> > > If you're inside of user.rb, then user.uname won't have any context. Try > self.uname or just uname, and see if that works. > > Walter > > -- > 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@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.