validation custom message for rails 3
Solution 1:
Try this
validates :title, presence: { message: "Story title is required" }
Solution 2:
Actually, I did this in a better way. If you want to remove the field title from the message you should use this on your _form.htmk.erb view:
As you can see inside this view:
<ul>
<% @article.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
Replace it by:
<ul>
<% @article.errors.each_with_index do |msg, i| %>
<li><%= msg[1] %></li>
<% end %>
</ul>
Solution 3:
A custom message for a boolean with conditionals might be:
validates :foo, inclusion: { in: [true, false], message: "cannot be blank" }, if: :bar?