[Rails] Re: STI Design Questions

2010-04-22 Thread DGerton
idea to use STI > on the answers, as some behaviour here will depend on which type the > question is. Instead of having a bunch if-tests everywhere checking > which type the question is and act accordingly, you can have 3 answer > types in parallel with the 3 question types and split the l

[Rails] STI Design Questions

2010-04-20 Thread DGerton
It's often hard to keep up with changes in RoR, especially when you're still learning. A lot information on the web is for older versions of RoR. So I want to make sure this design using single-table inheritance (STI) makes sense. My design need is identical to this: I have a Quiz class, a Quiz ha

[Rails] Efficiently building collections of nested sets

2010-03-08 Thread DGerton
This is question deals with the common example where Category has_many Products. (We'll use Species instead of Products here.) Assume Category is a nested class. Let's use this as the example: [Categories] Animals (id 1, parent_id=nil) -Mammals (id 2, parent_id=1) --Rodents (id 3, parent_id=2) -B