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

Allow a Form to mimic a model with an attribute with the same name #44

Merged

Conversation

leio10
Copy link
Contributor

@leio10 leio10 commented Jan 31, 2018

Currently, having a Form with an attribute with the same name of the mimicked model does not work well. In some cases, the value of the attribute is overwritten with the mimicked model data, resulting in invalid data.

With these changes, data from the mimicked model will override the params_hash hash values and the behavior will be the right one.

The only unsupported scenario is when the attribute contains a hash value, as it would be very difficult for the code to determine if the hash is the mimicked model information or the value for the attribute.

I modified tests to check this situation.

@deivid-rodriguez
Copy link
Contributor

@andypike Friendly ping :)

@deivid-rodriguez deivid-rodriguez force-pushed the fix/same_name_for_mimic_and_field branch from 47e2b8c to 3fe5ac0 Compare June 2, 2018 02:27
@deivid-rodriguez
Copy link
Contributor

@andypike We have rebased this branch as well, so it's easier for you to review it and potentially merge this. Thanks!

Copy link
Owner

@andypike andypike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this issue, very much appriciated! <3

@andypike andypike merged commit 6bb7dcb into andypike:master Oct 16, 2018
@deivid-rodriguez deivid-rodriguez deleted the fix/same_name_for_mimic_and_field branch October 16, 2018 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants