Skip to content

Fix human attribute_name to handle deeply nested attributes #5843

Merged
merged 1 commit into from May 30, 2012

5 participants

@kuroda
kuroda commented Apr 14, 2012

When a model nests another model that also nests yet another model
using accepts_nested_attributes_for method, its Errors object can
have an attribute name with "contacts.addresses.street" style.

In this case, the dots within the namespace should be substituted
with slashes so that we can provide the translation under the
"activemodel.attributes.person/contacts/addresses.street" key.

This commit is related to #3859.

@MSNexploder

+1

being affected (and annoyed) by this on a regular basis. :(

@steveklabnik
Ruby on Rails member

This no longer merges cleanly, and needs rebased.

@kuroda kuroda Fix human attribute_name to handle deeply nested attributes
When a model nests another model that also nests yet another model
using accepts_nested_attributes_for method, its Errors object can
have an attribute name with "contacts.addresses.street" style.

In this case, the dots within the namespace should be substituted
with slashes so that we can provide the translation under the
"activemodel.attributes.person/contacts/addresses.street" key.

This commit is related to #3859.
b0e2fc8
@kuroda
kuroda commented May 15, 2012

Rebased.

@carlosantoniodasilva
Ruby on Rails member
@josevalim josevalim merged commit 555d815 into rails:master May 30, 2012
@kuroda kuroda added a commit to kuroda/rails that referenced this pull request Jun 6, 2012
@kuroda kuroda Fix human attribute_name to handle deeply nested attributes
This is a back-port of b0e2fc8 to Rails 3.2.
See #5843 and #3859 also.
029936e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.