Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always store errors details information with symbols #26552

Merged
merged 1 commit into from
Sep 19, 2016

Conversation

rafaelfranca
Copy link
Member

When the association is autosaved we were storing the details with string keys. This was creating inconsistency with other details that are added using the Errors#add method. It was also inconsistent with the Errors#messages storage.

To fix this inconsistency we are always storing with symbols. This will cause a small breaking change because in those cases the details could be accessed as strings keys but now it can not.

Fix #26499.

[Rafael Mendonça França + Marcus Vieira]

@rafaelfranca rafaelfranca force-pushed the fix-errors-details-storage branch 2 times, most recently from a38be31 to 9c8d76a Compare September 19, 2016 22:51
When the association is autosaved we were storing the details with
string keys. This was creating inconsistency with other details that are
added using the `Errors#add` method. It was also inconsistent with the
`Errors#messages` storage.

To fix this inconsistency we are always storing with symbols. This will
cause a small breaking change because in those cases the details could
be accessed as strings keys but now it can not.

The reason that we chose to do this breaking change is because `#details`
should be considered a low level object like `#messages` is.

Fix rails#26499.

[Rafael Mendonça França + Marcus Vieira]
@rafaelfranca
Copy link
Member Author

@matthewd are you fine with backporting this to 5-0-stable?

@rafaelfranca rafaelfranca merged commit c40c0fe into rails:master Sep 19, 2016
@rafaelfranca rafaelfranca deleted the fix-errors-details-storage branch September 19, 2016 22:59
@matthewd
Copy link
Member

👍

rafaelfranca added a commit that referenced this pull request Sep 20, 2016
Always store errors details information with symbols
@rafaelfranca
Copy link
Member Author

Backported in ac0c589

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ActiveModel::Errors#details has string keys when accepts_nested_attributes_for model is invalid
3 participants