rails中的集合列表best_in_place

时间:2015-06-01 12:17:39

标签: ruby-on-rails ruby gem best-in-place

我需要类似的东西

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集合列表,用于添加值和填充集合。

1 个答案:

答案 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" %>