Giter VIP home page Giter VIP logo

Comments (2)

jonlhouse avatar jonlhouse commented on June 26, 2024

Hmm... which fork are you using? My first test of dependent => destroy seems to work

My model looks like:

class Condition < ActiveRecord::Base
  acts_as_citier
  belongs_to :testable, :polymorphic => true
end

class ConditionSet < Condition
  acts_as_citier
  has_many conditions, :as => :testable, :dependent => destroy
end

And my rspec test using FactoryGirl to create one condition_set object with 3 associated conditions (of different types) look like this:

it "should destroy child associations" do
  cond = Factory(:complex_cond_set)
  (conds = cond.conditions).should_not be_empty
  Condition.all.should_not be_empty
  cond.destroy
  conds.conditions.should be_empty
  conds.each { |c| Condition.find_by_id(c.id).should be_nil }
end

This passes. I still haven't associated a non-citier model with a citier one, that's next up. For example: Model A has_many :conditions, :as => :testable, :dependent => :destroy I'll let you know if that passes or not.

from citier.

surzycki avatar surzycki commented on June 26, 2024

This passes. I still haven't associated a non-citier model with a citier one, that's next up. For example: Model A has_many :conditions, :as => :testable, :dependent => :destroy I'll let you know if that passes or not.

Is what is not working for me.

As well. If you don't save your citier model before attaching a non citier association to it, it will not properly populate the foreign keys...

Let me know if you have a different experience. I really love the concept, the performance gains from not having to do joins is a real bonus....

from citier.

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.