# Tips for Data Model

**URL:** <https://www.ruby-forum.com/t/tips-for-data-model/155384>\
**Category:** Rails\
**Created:** [December 11, 2008, 9:27am UTC](https://www.ruby-forum.com/t/tips-for-data-model/155384 "2008-12-11T09:27:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9fc29f/32.png) [@gil](https://www.ruby-forum.com/u/gil)\
**Post date:** [December 11, 2008, 9:27am UTC](https://www.ruby-forum.com/t/tips-for-data-model/155384/1 "2008-12-11T09:27:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9fc29f/32.png) [@gil](https://www.ruby-forum.com/u/gil)\
**Post date:** [December 11, 2008, 2:15pm UTC](https://www.ruby-forum.com/t/tips-for-data-model/155384/2 "2008-12-11T14:15:56Z")

</div>

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
