I\'m using the simple_form gem. I want to customize the error message displayed when a user fails validations. How can I accomplish this?
You can declare the content of the error message in your model:
validates_length_of :name, :minimum => 5, :message => "blah blah blah"
You can set id
or class
for your
error tag:
<%= f.input :name, :error_html => { :id => "name_error"} %>
Then you can use CSS for the styling.
And you can use
<%= f.error :name, :id => "name_error" %>
and you'll get
is too short (minimum is 5 characters)