gil
#1
I can’t quite seem to get the data model down for a fairly simple set
of data.
The data is:
Framework --> Strand --> Level --> Benchmark
It would be simple enough if there were only three levels but since
there are four I can’t use straight has_many xyz :through clause.
The end goal is to have users be able to select a framework, then a
strand, then a level, then a benchmark.
Any help would be appreciated.
gil
#2
I’m not sure I understand why the number of levels (3, 4, or 104) is an
issue. So, perhaps I’m not understanding your question. But why not:
class Framework < ActiveRecord::Base
has_many :strands, :dependent => :destroy
end
class Strand < ActiveRecord::Base
belongs_to :framework
has_many :levels, :dependent => :destroy
end
class Level < ActiveRecord::Base
belongs_to :strand
has_many :benchmarks, :dependent => :destroy
end
class Benchmark < ActiveRecord::Base
belongs_to :level
end
–wpd