Hi, this is my first post to the list. I’m still learning the rails
framework, having done most of my previous web development in PHP. I’ve
done a bit of googling for the answer to this question, but maybe I’m
just lacking the right word to search for.
Several parts of my site, such as sidebar components, are
self-contained, modularized and re-used in several parts of the site.
The sidebar is part of the layout (I’m using the nested_layout plugin),
rather than the page view.
/app/layouts/layout_3_col.rhtml
However this means I need to generate the data for the sidebar
components within each model, and not more-cleanly in a separate model
for the sidebar component itself.
What I am after is a system where I could create a separate model, view
and controller for each sidebar component and then call render :url =>
/sidebars/left_col/3
I’m assuming a similar approach would be used in AJAX, where you replace
a DIV with a HTML fragment generated on the server, but would want to
show the fragment as part of the original page without generating a
series of AJAX requests on page load.
Is this possible in rails, whats the technique called (so I can google
for it) or am I going about it the wrong way.
Thanks in advance.
–
James