Best way to embed dynamic content


#1

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?

TIA


Alan removed_email_address@domain.invalid - http://arcterex.net

“Backups are for people who don’t pray.” – big Mike


#2

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.