Comments (2)
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.
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)
- undefined method `create_view' HOT 4
- How to use the latest Citier code? HOT 6
- item.type is deprecated HOT 1
- superclass mismatch for class SQLiteAdapter HOT 4
- Getting citier to work with SQL server
- Citier will not allow a migration for me. HOT 4
- How to suppress the citier logging HOT 1
- Unable to call destroy on Citier subtype HOT 2
- :counter_cache => true support
- relation_methods.rb delete_all strange behavior HOT 2
- View_xxx does not exist | PostgreSQL HOT 2
- Docs need some updating
- Inserting a new inherited class in the middle
- stack level too deep (when changing model inheritance)
- Two level inheritance => fetch issue HOT 1
- update_all raises ActiveRecord::StatementInvalid
- rake db:setup fails on fresh database HOT 1
- Rspec tests failing - stack level too deep error
- STI class not inheriting attributes from citier child class HOT 6
- Two level inheritance, Child Class don't inherit Middle Class attributes 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 citier.