GithubHelp home page GithubHelp logo

Comments (5)

moiristo avatar moiristo commented on July 29, 2024

You're follow_up association looks a bit mangled, what's going on there?

  • follow_up is has_many, therefore it should be follow_ups, or it should be a has_one association instead
  • A follow_up is a Question? Then why is its foreign key id called parent_option_id?

What actually happens (I think) is the following:

  • An Option record is found and cloned
  • The follow_up association is found and cloned
  • In the cloned FollowUp, deep_cloneable passes the cloned option to the inverse association (should be something like belongs_to :option, inverse_of: :follow_up in follow_up)
  • For some reason, AR expects a collection of objects instead of a single Option object. That's what the error shows. Therefore I think your associations are not correctly specified.

from deep_cloneable.

gangleton avatar gangleton commented on July 29, 2024

follow_up is a naming problem that I inherited with this code base, I know it's not correct.

A follow_up is a question that belongs to an option. Options have two associations with Questions- one as a belongs_to, and one as has_many. The other side of that is

Question belongs_to :option, :foreign_key => "parent_option_id", inverse_of: :follow_up

The foreign key is stored on Question.

from deep_cloneable.

moiristo avatar moiristo commented on July 29, 2024

Ok, I need to reproduce the error in the test suite first in order to fix it. I'll try to add one shortly.. unless you'd like to give it a try yourself of course ;)

from deep_cloneable.

gangleton avatar gangleton commented on July 29, 2024

I should be able to do that this afternoon…

On Sep 13, 2016, at 12:12 PM, Reinier de Lange [email protected] wrote:

Ok, I need to reproduce the error in the test suite first in order to fix it. I'll try to add one shortly.. unless you'd like to give it a try yourself of course ;)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #67 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AAM3e8imrYqFU82P5OAtKj4mMI4oeEXbks5qpvWdgaJpZM4J7DFl.

from deep_cloneable.

moiristo avatar moiristo commented on July 29, 2024

This should be fixed by #71 (release 2.2.2).

from deep_cloneable.

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.