Import .rb files in other .rb files (for the 'view')

Hi All

I have a complex structure (a lot of

's) which occures in a couple
of views.

I think I red somewhere that it is possible to put this structure in a
seperate .rb file, which can then be included into the other (.rb)
files.

Can someone point me into the right direction of how to do this ??

Thnx a lot
LuCa

Luca S. wrote:

Hi All

I have a complex structure (a lot of

's) which occures in a couple
of views.

I think I red somewhere that it is possible to put this structure in a
seperate .rb file, which can then be included into the other (.rb)
files.

Can someone point me into the right direction of how to do this ??

Thnx a lot
LuCa

Partials are your friend.

#app/views/foo/index.rhtml
<% @items.each do |item| %>
<%= render :partial => ‘item’, :locals => {:item => item} %>
<% end %>

#app/views/foo/_item.rhtml

Item #<%= item.id %>

<%= textilize(item.description) %>