Ruby on rails 3 如何处理rails3中的链接到函数

Ruby on rails 3 如何处理rails3中的链接到函数,ruby-on-rails-3,link-to-function,Ruby On Rails 3,Link To Function,这是我的密码 <%= link_to_function ("Add another url", :id=> "add_another_url_link_id") do |page| page.insert_html :bottom ,:add_another_url, :partial =>'add_another_url', :locals => {:object =>Url.new, :url => secti

这是我的密码

<%= link_to_function ("Add another url", :id=> "add_another_url_link_id") do |page| 
                      page.insert_html :bottom ,:add_another_url, :partial =>'add_another_url', :locals => {:object =>Url.new, :url => section}
                    end%>
“添加另一个url链接id”)do | page |
page.insert_html:bottom,:add_other_url,:partial=>'add_other_url',:locals=>{:object=>url.new,:url=>section}
结束%>
在这里,我显示了
add\u-other\u-url
partial,位于
add\u-other\u-div
的底部。 我有一张单子。在第二行的末尾,我展示了这个链接。当我单击将在行下显示表单的链接时。但当我单击仅在第一行下显示表单的链接时。 我想显示对应行的表单。(我不知道在这个地方怎么用“this”)


有人能帮我吗。

我假设您为列表中的每一行生成此链接。这是个坏主意,因为它会为每一行无效的html生成相同的元素id(添加另一个url链接id)

您应该生成单个ID:

<%- @items.each do |item| %>
  <%= link_to_function "Add another url", :id => "add_url_for_item_#{item.id}" do |page| %>
    ...

“为项目添加url”{item.id}“do | page |%>
...
并使用特定id查找相关行