what will be if i display another controller , it will give me undefined method cause left column is depended on product controller ,i want a template working in many controllers
On Jun 19, 11:10 pm, Philip Hallstrom <[email protected]> wrote: > On Jun 19, 2009, at 1:08 PM, lecielbleu wrote: > > > > > <% content_for :left_column do %> > > <%= render :partial => 'left_column' %> > > <% end %> > > > where this codes should be? in the layout folder? > > No... that would go in say /app/views/products/_left_column.html.erb > > THen when you're in your products views you could use the above to > load up that left column. > > > if i understand , i must generate 2 files (one is template ,other one > > is _left_column.html.erb partial templats) , am i right? > > > On Jun 19, 9:53 pm, Philip Hallstrom <[email protected]> wrote: > >>> Hi , imagine that you have one layout and every point of that is > >>> made > >>> with another templates. how can i handle this situation. For example > >>> in the left column ,displaying list of subcategories depending on > >>> category which is displayed at this time in the center of site (<%= > >>> yield :layout %> line). it might be develop , making navigations > >>> randomly changing like amazon.com > > >> I typically do it like this: > > >> layouts/application.html.erb: > > >> .... > >> <div id='main-content'> > >> <%= yield %> > >> </div> > >> ... > >> <div id='left-column'> > >> <%= yield :left_column %> > >> </div> > > >> Then in my other views I do whatever is simplest to generate content > >> for the left column... perhaps... > > >> <% content_for :left_column do %> > >> <%= render :partial => 'left_column' %> > >> <% end %> > > >> Where that would pick up a specific left_column partial for that > >> controller. That sort of thing... > > >> -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

