Hi everyone. I was trying to customize AR validation error messages and came across this kind of message lookup order, which EVERY I18n guide in existence seems to be giving:
~~~ activerecord.errors.messages.models.user.attributes.name.blank activerecord.errors.messages.models.user.blank activerecord.errors.messages.blank ~~~ I tried to follow that, but, to my surprise, only least-detailed variant worked: "activerecord.errors.messages.blank". After a bit of research I've found out that lookup paths for Rails 2.2.2 are different from what's stated above. I.e. the ACTUAL paths being used are: ~~~ activerecord.errors.models.user.attributes.name.blank activerecord.errors.models.user.blank activerecord.errors.messages.blank ~~~ My test localization yaml is (model name is 'script'): ~~~ en: activerecord: errors: messages: blank: I'm errors.messages.blank models: script: # As documented, doesn't work. blank: I'm errors.messages.models.script.blank attributes: name: # As documented, doesn't work. blank: I'm errors.messages.models.script.attributes.name.blank models: script: # Not as documented, but it works. blank: I'm errors.MODELS.script.blank attributes: name: # Not as documented, but it works. blank: I'm errors.MODELS.script.attributes.name.blank ~~~ That kind of discrepancy in I18n guides seems rather serious to me, so I'm asking everyone who's in contact with guide authors or wikis to fix AR message lookup paths in documentation. If that's a confusion or version mismatch on my side, please correct me. I'm using Rails 2.2.2. Here are some guide links that seem to be WRONG: http://guides.rails.info/i18n.html http://rails-i18n.org/wiki/pages/i18n-rails-guide (and more, just search for 'activerecord.errors.messages.models.user') This page is RIGHT on lookup order: http://api.rubyonrails.org/classes/ActiveRecord/Errors.html Alex -- Posted via http://www.ruby-forum.com/. _______________________________________________ Railsi18n-discussion mailing list Railsi18n-discussion@rubyforge.org http://rubyforge.org/mailman/listinfo/railsi18n-discussion