0

I'm trying to make a link in common. So I tried to make one in application_helper.rb.

But it seems not possible. How do I usually do this when I want to make link which will be used in common.

application_helper.rb

module ApplicationHelper

  def platform_search(genre_id)
      <%= link_to "<span class='btn btn-danger'>#{community.genre.name}</span>".html_safe, communities_path(:search => '' ,:genre => community.genre_id )%>
  end

end
4

1 回答 1

4

您应该能够link_to在助手中使用。由于<%=.

ERB的<%= %>is 语法(认为视图),而不是 Ruby。删除那些分隔符。

于 2013-01-07T02:23:57.440 回答