in rails 3 i don't want to show field names in error messages. Anyone know how to do that ?
validates_presence_of :title, :message => "no title"
it shows
Title no title
i want
no title
In your form view change your current code
<%@object.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %>
With this
<%@object.errors.messages.values.each do |msg| %> <%msg.each do |m| %> <li><%= m %></li> <%end %> <% end %>
This worked for us (Rails 4):
<% resource.errors.each do |attr,msg| %> <li><%= msg %></li> <% end %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With