[Rails] :message with new style validates?
I found some questions posted in this regard in the past, but I
couldn't find anything conclusive. Hence this post, with two
questions. This is in context of Rails 3.x.
1. Is it recommended (as a matter of "style") to use the
"validates :name, :presence => true" instead of more verbose
"validates_presence_of :name"? (RailsGuides promotes the latter, I
think)
2. If it is the former, how do I specify custom messages when a
particular validation fails? Any examples? What if I need to have
different messages for different criteria (e.g. with :presence and
with :format)?
Thanks in advance,
Kedar
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home