views:

92

answers:

1

Hy,

I have a layout in the views/layout that has 2 cols and then in every view i have content_for :main_col and content_for :side_col. The problem is that i have more than 5 views with the same content in the content_for :side_col

You have a better idea on how to do this?thanks

+5  A: 

Put it into a partial and render the partial where you need it.

app/views/shared/_sidebar.html.erb

<% content_for :sidebar do %>
  Hello, I am your neighbourhood friendly sidebar!
<% end %>

app/views/somewhere/else.html.erb

<%= render :partial => "shared/sidebar" %>
Ryan Bigg
Yes, thats a great idea!using the content_for in the partialthank you very much!
Totty