我需要类似的东西
f.select(:category_id, @categories.collect {|p| [ p.name, p.id ] } + [ [ 'Or create a new one', 'new' ] ], {:include_blank => 'Please select a category'})
用于best_in_place
集合列表,用于添加值和填充集合。
答案 0 :(得分:0)
尝试使用
<%= f.select :category_id, options_for_select(@categories.collect {|p| [ p.name, p.id ] } + [ [ 'Or create a new one', 'new' ] ]), {:include_blank => 'Please select a category'}, class: "form-control" %>