I have a 'user' and a 'profile' model. The user has one to one relationship with profile and "accepts_nested_attributes_for profile".
I'm validating profile with two checkboxes - that is to say one of the agreements must be accepted before it's validated.
Anyway, I want to customise the error message for not accepting one of the boxes so I added the following into en.yml
activerecord:
attributes:
user:
profile:
terms_and_conditions_a:
accepted: "You must accept the terms and conditions to continue"
terms_and_conditions_b:
accepted: "You must accept the terms and conditions to continue"
You'll see that profile is nested under user - this is to stop "Profile" being put at the front of the error message (as explained here).
This gives me the error:
I18n::InvalidPluralizationData
translation data {:terms_and_conditions_a=>{:invalid=>"You must accept the terms and conditions to continue"}} can not be used with :count => 1
I don't really see what it's trying to pluralize, any help?
Maybe it should be
activerecord:
errors:
models:
user:
profile:
attributes:
terms_and_conditions_a:
accepted: "You must accept the terms and conditions to continue"
rather than
activerecord:
attributes:
user:
profile:
terms_and_conditions_a:
accepted: "You must accept the terms and conditions to continue"
?
That's how it is in my app, which is admittedly rails 2 rather than rails 3.
Alternately, try not nesting profile under user:
activerecord:
errors:
models:
profile:
attributes:
terms_and_conditions_a:
accepted: "You must accept the terms and conditions to continue"
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