开发者

multiple CSS class/id names using Ruby on Rails 3 form helpers

开发者 https://www.devze.com 2023-01-07 21:45 出处:网络
I am attempting to pass 2 classes to an element in a rails 3 application and having some issues with encoding.

I am attempting to pass 2 classes to an element in a rails 3 application and having some issues with encoding.

 <td class="edit">
   <%= link_to 'Edit', edit_link_url(link, :class => 'edit_link ui') %><br />
   <%= link_to 'Delete', link_url(link, :class =>'delete_link ui'), :confirm => 'Are you sure?', :method => :delete %>
 </td>

can someone offer some insight on the best way to pass 2 classes to an开发者_StackOverflowd element in RoR.

The current output in edit_link+ui

Thanks in advance.


Remove them from the params of the link.

<%= link_to('Edit', edit_link_url(link), :class => 'edit_link ui') %><br />
<%= link_to('Delete', link_url(link), :class =>'delete_link ui', :confirm => 'Are you sure?', :method => :delete) %>


Looks like a brackets problem. The class should be applied to the link_to not the url helper.

0

精彩评论

暂无评论...
验证码 换一张
取 消