2015-10-03 216 views
0

我有3種可能性列,說(水果,蔬菜,肉類)。我想用一個下拉列表來過濾我的行,所以它只顯示水果或蔬菜等行。我一直在尋找ransack gem,但所有的例子都讓你在文本字段中輸入內容。我打算有幾個下拉菜單來過濾其他列。即使是這樣做的最佳方式,快速搜索呢?護欄下拉搜索/過濾搜索

+0

是的,你可以去洗劫 – Muntasim

回答

0
<%= f.select :poollength_eq, options_for_poollength, {:include_blank => "Select Pool Length"}, {:style => "width:175px", class: "form-control"} %> 

我在application_helper.rb定義options_for_poollength爲

def options_for_poollength 
    [['Long Course Meters','LCM'], ['Short Course Yards','SCY'], ['Short Course Meter','SCM']] 
end