Ruby on Rails Sunday, October 3, 2010

v

On Sun, Oct 3, 2010 at 12:07 PM, John T. <lists@ruby-forum.com> wrote:
In Rails < 3, I could have a validation on model such as:

validates_presence_of :name, :message => "some custom message here"

If I try something similar in Rails 3:

validates :name, :presence => true , :message  => "some other custom
message"


validates :name, :presence =>  {"some other custom"}

most options are now passed like that , for example


validates :name, :unique => {:scope => :company_id}

you see, options are now passed as hashes to the validation key

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment