-
Notifications
You must be signed in to change notification settings - Fork 24
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
:dependent => :destroy #35
Comments
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: |
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.... |
Doesn't seem to work for model associations on citier child models
Any model association on a citier child model will not be destroy when the parent is destroyed
ie
has_many :promotions, :dependent => :destroy
is on a citier model
promotions will hang around even after the citier model is wacked
The text was updated successfully, but these errors were encountered: