-
Notifications
You must be signed in to change notification settings - Fork 68
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
Rails 3.1 custom serialization and it does not clone correctly #3
Comments
Hi, thanks for the report... can you give me a little more context as to how this is being used? A simple test case perhaps? I'm mostly curious where this fits in to the context of your actual ActiveRecord model. Glad you like the gem, and hopefully we can get this resolved for you ASAP :) |
Yes let me do some more digging. I ran into this late in the evening, so let me clarify it a bit more. |
cool, thanks |
Here is the insert statement of the item. It is part of a recursive dup
It creates this:
The original is:
All this is too much detail. The path is serialized and is saved: ["path", []] but the serialization of the empty array produces an empty string. I'll try to setup a test case for it |
hey, I will have a look at this ASAP, thanks |
I submitted a pull request with the failing test case. Is easily reproduceable. I looked at your source code, i don't understand why it is breaking though. The fields are not association fields and should be handled by the regular dup which works correctly. Somehow the custom serialization is getting overridden by default serialization. |
have you tried using |
This doesn't look to be very well documented. What you are referring to with passing the Class is it will expect what it pulls out of the database to be that Class. I read that Rails 3.1 supported custom serialization because they refactored the serialization, then I just looked for examples. I don't see it in the documentation. This is the closest thing I found: http://stackoverflow.com/questions/8638830/more-complex-activerecord-object-serialization If you see the pull request it has the syntax, after you run it you can see the sqlite db, the create statements work as expected, but the amoeba duplication does not. Regular duplication does work though. |
Maybe it's related to this |
So I just implemented spec for plain serialized columns and amoeba has no errors. In addition, the pull request you submitted did not test amoeba, it only tested the original object aka Good luck. |
This gem is amazing. This is some serious meta-fu. Is very impressive.
I am using a custom serialization class in one of my models and I am not getting a correct clone.
This is probably some bad programming but I have a class to store an array of numbers as a sorted comma separated string. I don't think it is cloning correctly.
The text was updated successfully, but these errors were encountered: