views:

20

answers:

1

Hello Rubsters

So, I need to be able to display a small 'about our products' blurb on every single one of the product pages. I also need this blurb to be editable through the app interface, and not appear as a static page alone.

I have a static Page model with title, permalink, and content; and PagesController set to find_by_permalink as per (one of many fantastic) Ryan Bates' railscasts.

It seems to me that a product_blurb column in the model would be silly: you'd have to edit all the products individually to make a change; and by adding the blurb as an entry into the pages table would mean mysite.com/blurb would spit out the info as a static page.

How do I go about thinking about this problem?

Thanks as ever

A: 

It sounds like it could be saved into a plain file (with caution). And then you can render it with:

<%= render_to_string :file => '/path/to/file %>

And if it needs some info from one or more of your models - then use a header/footer or a template for this template ;)

Roman
Thanks for your answer Roman; it is a possibility for sure. It would mean teaching the (techno-phobic) user about ftp. I have just got her to use textile to edit the static pages, and that was hard enough :-) I have also thought about having a blurb model that contains a single entry but there must be a more elegant solution.
Adam