Reputation: 6189
In a rails 3.2.16 app form submission, error messages are not flowing i18n-ized to the view. Based on the following model definition
validate :not_overlap
def not_overlap
errors.add(:start, 'message') if overlaps?
end
I have not been able to insert the translation code helper
The following is the locale file:
activerecord:
models:
optionrate: "Options"
attributes:
optionrate:
start: "Start"
end: "End"
errors:
models:
optionrate:
attributes:
start:
not_overlap: "Dates overlap existing options."
end:
not_overlap: "Dates overlap existing options"
I am also unsure about the
<% @optionrate.errors.full_messages.each do |msg| %><%= msg %>
command and its i18n...
...which sort of makes 3 rabbits to run after
What am I doing wrong?
Upvotes: 0
Views: 242
Reputation: 171
I think the second argument to errors.add needs to be the symbol of the error message you're trying to add. So:
errors.add(:start, :not_overlap)
You've probably fixed this by now though!
Upvotes: 1