I’m working on a small project (5 major pages, 1 with 4 linked off, 1
linked off) and I was going to just do it all in flat html files with
dreamweaver templates (yeah, I was being kinda lazy). I got the sigle
sections done and find out, it would really be nice to do this page in
a database (list of new products). So I thought, hey maybe this is a
use for rails (don’t laugh! I’m desperate for an excuse).
After about 1 hour I had my dreamweaver pages put into a rails project
layout.rhtml and the contents broken out into template files. I was
giggling with joy.
I made a Page controller with these actions: index, about, contact,
and information. The Page template has a sidebar menu, @submenu to
render as partial template
Information needs a sidebar menu, so in the method information
specified the name of the template to render :partial=>@submenu
Also in the Page controller I had methods information_safety,
information_fundraising, and information_faq … each setting
@submenu to “info_menu”
Then I come to the product section, which has 4 sections and I did the
thing. It worked.
(so far no database interation)
Then I thought, maybe the better design was to create a Product
So I did. I set the submenu template name in the initialize method, and
it to use layout “Page” I tweaked the link in the layout/page.rhtml to
the Product controller. It worked.
Which is the better way or are both ways stupid and you have a better