For the life of me, I cannot find how to remove "model name" before the error message. Typically this would be ok but hear me out.
I have a model called 'foo'. I'd need to rename it at some point but for now it's a hassle. For now, I need to change the error message: "Foo How often you get paid is missing".
# finance.rb
belongs_to :foo # this will be renamed in the future
[..]
I thought I needed to edit the en.yml only:
en:
activerecord:
errors:
models:
finance:
attributes:
foo:
required: "How often you get paid is missing"
This works but I don't need to show the model's name with the message. Ok I could do some string replace but that's ugly. Is it possible to only show the message in the en.yml
?
EDIT:
Error are displayed as:
<% if @finance.errors.any? %>
<ul>
<% @finance.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<% end %>
Seems to be an easy solution found here. So in my case:
This could be a duplicate post so you could mark as duplicate