rails/rails — pull request #11873 by calebthompson (2013-08-13 20:07:28+00:00)
Title: Allow errors on arbitrary keys to use message i18n

ActiveModel::Errors reads attributes to allow them to be used in translations
for messages. It also allows errors to be added to arbitrary keys.

Rather than switching on the 'magic' `:base` key, check to see if the base
object responds to the attribute before trying to read it.

By doing this, we allow translations to be used to generate messages for
errors on attributes to which the base model does not respond, generating more
meaningful errors while not relying on strings for the messages.