Re: [Rails] Re: Nested categories, nesting has_many :through a HABTM relationship

2010-12-08 Thread Rick R
On Wed, Dec 8, 2010 at 2:39 AM, Roger wrote: > > All of that being said, I solved the problem (possibly improperly) by > doing this: > > 1) Adding a scope definition to feature_types called "with_car", so, > FeatureType.with_car would find me the feature types that, by process, > can exist under

Re: [Rails] Re: Nested categories, nesting has_many :through a HABTM relationship

2010-12-08 Thread Rick R
On Wed, Dec 8, 2010 at 2:39 AM, Roger wrote: > > def feature_types >results = Hash.new >prev = nil >@features.each do |f| > if (f.feature_type.name != prev) >results[f.feature_type.name] = [] > end > results[f.feature_type.name] << f > prev = f.feature_type

[Rails] Re: Nested categories, nesting has_many :through a HABTM relationship

2010-12-07 Thread Roger
The issue with both each of these posts is that the code will not work in a lot of situations due to one small hole. I was hoping to do this entire thing with a DB, I think I may have now found that way to do this through the post. In either case, the hole with that particular iterator comes from