2009/4/29 Robert Walker <rails-mailing-l...@andreas-s.net>

>
> Daniel Bush wrote:
> > 2009/4/29 Chris Hanks <rails-mailing-l...@andreas-s.net>
> >
> >>   has_many :examples, :as => :sections
> >> And get:
> >> sections for each tutorial, also, to make sure they appear in the right
> >> order.
> >>
> >> Does that make sense? I think single table inheritance might do this,
> >> but I'm planning on using examples and questions for a bunch of other
> >> things, so I don't think it would work that well. I'm thinking about
> >> defining a whole new "section" model, and using that, but I don't know
> >> yet.
>
> I must be missing something here, but given that you have separate
> models [Tutorial, Question, Example] then what's wrong with:
>
>
I might be missing something too and over-complicating things.
The Section model in my previous post has a position attribute and allows
Chris to create a tutorial of ordered sections where each section is linked
to an Example or Question.
I'm not sure how you guarantee that with your version, although maybe with
some effort you could.
Because the Examples and Questions are has_many Sections, they are also
reusable in a future tutorial; it is the sections that are tied specifically
to a given tutorial instance.

Anyway, it seemed like the Section abstraction was a nice way to show off
polymorphic routes.

-- 
Daniel Bush

http://blog.web17.com.au
http://github.com/danielbush/sifs/tree/master
http://github.com/danielbush

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to