我需要类似的东西。
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集合列表,用于在集合中添加值和填充。
发布于 2015-06-01 21:08:02
尝试使用
<%= 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" %>https://stackoverflow.com/questions/30573316
复制相似问题