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

Support normalizing attributes even if they are not backed by database columns #2

Closed
wants to merge 2 commits into from

Conversation

rusterholz
Copy link

Our team needed to use this gem to normalize model attributes that were not directly backed by database columns. (Our specific use case involves several attributes handled by the attr_encrypted gem, but any attribute that's set via standard accessor methods should, in principle, be normalizable.)

This PR changes the apply_normalizers method so that it will first attempt to use ActiveRecord's write_attribute method, but fall back to using a standard setter method if that attempt fails.

A spec was added to test this behavior.

@fnando
Copy link
Owner

fnando commented Apr 1, 2015

Cherry-picked. Thanks for your patch. ;)

@fnando fnando closed this Apr 1, 2015
@rusterholz
Copy link
Author

Thanks for your fast response!

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.

None yet

3 participants