这里我尝试在rails中添加link_to
元素的类。
这里我有link_to元素,我为这个元素添加了类。但是我收到了错误..
这就是我所做的
<%= link_to '+ Add New Product', :class => 'btn btn-primary', {action:"new_product_list_path"} %>
我得到的错误是
syntax error, unexpected ')', expecting => ...tion:"new_product_list_path"} );@output_buffer.to_s ... ^
syntax error, unexpected keyword_ensure, expecting ')'
syntax error, unexpected keyword_end, expecting ')'
我该如何解决这个问题?
答案 0 :(得分:2)
这是正确的版本:
<%= link_to '+ Add New Product', new_product_list_path, :class => 'btn btn-primary' %>