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"

obviously, it throws an exception. So the question is, in Rails 3, how
to you give a simple custom message? Do I need to go through and set up
a custom validation class for each validation, just to show a different
message? I've looked at:

http://www.railsapi.com/doc/rails-v3.0.0/classes/ActiveModel/Validations/ClassMethods.html#M003721

but it seems to show that a custom class would need to be set up for
each attribute of my models? I'm sure there's a shortcut, but have yet
to find it.

Thanks.
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to