2013-01-03 51 views
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”?
只有我想的是 “&流派= 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 %> 

回答

1
<%= select_tag :genre, options_for_select(Genre.all.map{ |g| [g.name, g.id] }) %> 
+0

非常感谢!它工作完美! – cat