Comments (10)
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 :)
from amoeba.
Yes let me do some more digging. I ran into this late in the evening, so let me clarify it a bit more.
from amoeba.
cool, thanks
from amoeba.
Here is the insert statement of the item. It is part of a recursive dup
SQL (2.1ms) INSERT INTO "configuration_sets" ("category_id", "created_at", "max", "min", "path", "primary_or_secondary", "source_id", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["category_id", 7], ["created_at", Thu, 12 Apr 2012 21:50:20 EDT -04:00], ["max", 1], ["min", 1], ["path", []], ["primary_or_secondary", "primary"], ["source_id", 844], ["updated_at", Thu, 12 Apr 2012 21:50:20 EDT -04:00]]
It creates this:
=> #<ConfigurationSet id: 1743, created_at: "2012-04-13 01:50:20", updated_at: "2012-04-13 01:50:20", path: [0], category_id: 7, primary_or_secondary: "primary", min: 1, max: 1, source_id: 844>
The original is:
#<ConfigurationSet id: 14, created_at: "2011-12-30 22:47:00", updated_at: "2012-04-06 20:22:59", path: [], category_id: 6, primary_or_secondary: "primary", min: 0, max: 0, source_id: 8>
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
from amoeba.
hey, I will have a look at this ASAP, thanks
from amoeba.
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.
from amoeba.
have you tried using ArrayPack
instead of ArrayPack.new
? ... the rails docs say you're supposed to just pass the model, not an instance of the model
from amoeba.
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.
from amoeba.
Maybe it's related to this
rails/rails#5810
from amoeba.
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 old_post
. This means that there is an error with your column serializer and not with amoeba. I'm closing this ticket for now, once you get your custom serializer working outside of amoeba, feel free to open a new ticket if amoeba does in fact break on your custom serializer.
Good luck.
from amoeba.
Related Issues (20)
- What licence should amoeba have
- `nullify` on a not-null column should set to default value HOT 1
- Regex preprocessing of field fails on null value
- `amoeba_dup` on rich_text field raises `NoMethodError: undefined method 'macro' on nil:NilClass` HOT 4
- Passing params into the amoeba function? HOT 2
- include_association also including other association, Which are not supposed to be included
- Consider implementing autoload for Active Support HOT 4
- Add checking for invalid configuration
- What is the difference between `customize` and `override`?
- Cloning breaks include list
- Release new version on rubygems HOT 1
- Trying to clone with has_many through association
- Using append on associated records.
- Inter dependant structure HOT 2
- Is it possible to use a dynamic value in this set block ?
- Does it work with Rails 6? HOT 3
- has_many dupes do not set belongs_to in memory HOT 2
- Is this gem abandoned? HOT 3
- How can I "move" has_many association instead of copy?
- Association custom query HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amoeba.