Forum: Ruby on Rails Best way to embed dynamic content....

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5bc3ee98b5a5bd0cd936554de2bdc232?d=identicon&s=25 Alan Bailward (Guest)
on 2006-05-07 19:31
(Received via mailing list)
Sorry for the newbie question here....

I've got a project that might be just right for RoR and to help me learn
about it more.  It's a travel site, with some admin / user functionality
that pretty much matches up with the agile dev with rails book and
tutorials.  The only part that I'm not sure the best way to do is they
want to embed some dynamic areas within the website.  IE: random pages
where you have some content that is database driven, but *not* all
within a nice defined say, /content controller area.  Also I'm sure that
the page names will change in the future.

IE: what I'm looking for (I think) is to just be able to put tags like

<%= dynamic_content_employee_profile %>
<%= dynamic_content_news_area_1 %>

etc in the pages, and have that all under a /content controller (or
something).  Though I'm not sure if that's the best way to do it (having
a bunch of static pages under a controller instead of the /public area.

What would be the best way to do this?  Is there a "rails" way to do
this properly?


Alan <> -
"Backups are for people who don't pray."                 -- big Mike
Bc7279484cc8b64ab5fd643832873955?d=identicon&s=25 cyx (Guest)
on 2006-05-07 20:22
You could use that method, and in your helper functions use
render_component if you want to separate the dynamic stuff into a
different controller.

alternatively, you may use render :partial for better performance, but
ultimately it's better to have it separated into functions so you can
delay the design / optimization decisions later on.
This topic is locked and can not be replied to.