如何在link_to remote中包含类?

时间:2015-04-19 18:19:13

标签: ruby-on-rails ruby-on-rails-4

我有这个代码,我想要包含glyphicon,但下面的代码不起作用。如果我删除了课程subcomment_link,它会有效,但我确实需要将其包含在jquery中。指定类的远程link_to的正确语法是什么?

<%= link_to new_subcomment_path(:response_id => response.id), class: "subcomment_link", id: "reply_new_subcomment#{response.id}", remote: true do %> 
    <i class="glyphicon glyphicon-pencil"></i>&nbsp Edit your profile 
<% end %>

1 个答案:

答案 0 :(得分:2)

尝试将其更改为:

<%= link_to new_subcomment_path(:response_id => response.id), {remote: true}, {class: "subcomment_link", id: "reply_new_subcomment#{response.id}"} do %>

通常标签选项位于html选项之前。