0

使用下面的代码,如果我点击搜索,它会将我带到这些网址

With FireFox > http://example.com/shop?utf8=%E2%9C%93&genre[]=1
With Safari  > http://example.com/shop?utf8=✓&genre%5B%5D=1

如何删除此“[]”和“%5B%5D”?
只有我想要的是“&genre=1”

查看代码

<%= form_tag communities_path, :method => :get, :class => 'form-search' do %>
   <div class="input-append">
    <%= collection_select :genre, nil, Genre.all, :id, :name %>
    <button type="submit" class="btn">Search</button>
   </div>
<% end %>
4

1 回答 1

1
<%= select_tag :genre, options_for_select(Genre.all.map{ |g| [g.name, g.id] }) %>
于 2013-01-03T02:00:09.043 回答