-
Notifications
You must be signed in to change notification settings - Fork 48
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
each_instance does not respect ActiveRecord serialize? #29
Comments
Hello! This is unexpected. There is no behavior in this gem to deal with serialized attributes; that should be handled by ActiveRecord. This method passes each data tuple to ActiveRecord::Base.instantiate() which should be responsible serializing/deserializing. What versions of Rails/ActiveRecord, Ruby, "pg" and "postgresql_cursor" gems are you running, and in what environment? Can you create a test app with only this model and postgresql_cursor to show the problem? |
Sure, I'll try and do that. I'm using Rails 4.2, most recent postgresql_cursor. Some quick digging reveals that if you don't pass |
It's been almost 3 years since the issue was opened and more than a year that the fix is ready, why you don't apply it? |
Hasn't it? Above PR was merged 18 months ago. |
I can pull together a more descriptive example if it's useful, but I have a JSON type in the db where I store arrays of stringified integers. I use
serialize
to serialize arrays of integers to arrays of strings upon save, and to deserialize back into arrays of integers upon load from the db.each_instance
doesn't appear to do this; a standard ActiveRecord load does.http://api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Serialization/ClassMethods.html
The text was updated successfully, but these errors were encountered: