Git Product home page Git Product logo

Comments (10)

rocksolidwebdesign avatar rocksolidwebdesign commented on August 28, 2024

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.

amalagaura avatar amalagaura commented on August 28, 2024

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.

rocksolidwebdesign avatar rocksolidwebdesign commented on August 28, 2024

cool, thanks

from amoeba.

amalagaura avatar amalagaura commented on August 28, 2024

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.

rocksolidwebdesign avatar rocksolidwebdesign commented on August 28, 2024

hey, I will have a look at this ASAP, thanks

from amoeba.

amalagaura avatar amalagaura commented on August 28, 2024

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.

rocksolidwebdesign avatar rocksolidwebdesign commented on August 28, 2024

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.

amalagaura avatar amalagaura commented on August 28, 2024

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.

amalagaura avatar amalagaura commented on August 28, 2024

Maybe it's related to this
rails/rails#5810

from amoeba.

rocksolidwebdesign avatar rocksolidwebdesign commented on August 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.