On Fri, Jul 23, 2010 at 19:42, Joel Klabo <joelkl...@gmail.com> wrote:

> But, if I had separate models for brewery also the URLs would be
> nested like crazy.

DISCLAIMER: fairly new to Rails myself, but not new to databases, nor
to software engineering (and coding concepts such as separation of
concerns), so this is sort of written from that POV.  The Rails-ish
way may be different, but the following is what Makes Sense To Me.

You don't need to have them so closely coupled, nor to have the models
nested at all.  The brewery, style, etc. could all be parameters of an
individual beer.  Then you can slap a search on top of your index
function.  So if you want to know what doppelbocks are made by the Foo
Manchoo Brew Krewe, you could do
index?style=doppelbock&brewery=Foo%20Manchoo%20Brew%20Krewe (or
whatever syntax you decide on for encoding multi-word things).  And of
course to find all doppelbocks, or all from the FMBK, omit one or the
other of the parameters.  And of course you could support other
parameters, like minrating= some number of stars, possibly separated
by rating authority, and so on.

-Dave

-- 
Specialization is for insects. | Professional: http://davearonson.com
-Robert Anson Heinlein         | Programming:  http://codosaur.us
-------------------------------+ Leadership:   http://dare2xl.com
Have Pun, Will Babble!  -me    | Et Cetera:    http://davearonson.net

-- 
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-t...@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