2013-01-03 100 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