-1
<%@nfo.each do |m|%>

  <table>

    <tr><p class="icons"><%= m.name %></p></tr>
          <tr> <%= image_tag  m.picture(:big)%><tr>

       <%@a -=1%>
   </div>

</table>
<% end %>

when I am using this at that time I can iterate it through each but I want to iterate it on another view file for that I made it some thing like

<%@nfo[i].name%>

  <table>

    <tr><p class="icons"><%= @info[i].name %></p></tr>
          <tr> <%= image_tag  @info[i].picture(:big)%><tr>


   </div>

</table>

and in another view I am rendring this form and want to pass the value of i but I am not able to pass how I can pass the value because now this form also giving error i is not define is it possible to send the value from one view to partial file like this

4

1 回答 1

1

您可以将变量传递给您的部分:

<%= render :partial => "your_partial", :locals => { :variable => value } %>

然后您可以通过本地哈希访问您的部分内容。因此,您只需在视图中传递变量。

于 2012-06-09T09:22:45.827 回答