amarradi
amarradi

Reputation: 115

rendering a different template in rails

i've a view with a

<%= render :partial => @list.items%>

To show the this command called the _item.html.erb. Right?

<div class="well">
  <%= image_tag item.photo.url(:small) %><br>
  <b>Title</b> <%= item.title %><br />
  <b>Description</b> <%= item.description %>
</div>

This works fine. Now i have an other template called _ilist.html.erb where i need some of this data. I try to render this by adding the template option. But the other template will not used. The first template will called anytime.

<%= render :partial => @list.items, :template => 'items/ilist' %>

Is there any option to call the other _ilist-template?

Thanks for your help

Upvotes: 0

Views: 315

Answers (1)

cpuguy83
cpuguy83

Reputation: 5993

I believe you need:

<%= render :partial => 'items/ilist', :collection => @list.items, :as => :item %>

Upvotes: 1

Related Questions