How do i get the rails default validation message?
How i can get the default error message in rails
for example
The default rails validation failed message for blank is "can't be blank"
how i can get these val开发者_开发百科idation message in rails 3 .
In Rails < 3.0 we can use ActiveRecord::Error.default_error_messages[:taken]
but it doesn't work in rails 2
You can get it with I18n
irb(main):0> I18n.t 'activerecord.errors.messages.taken'
=> "has already been taken"
精彩评论