【问题标题】:Collection list best_in_place in railsrails 中的集合列表 best_in_place
【发布时间】:2015-06-01 12:17:38
【问题描述】:

我需要类似的东西

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

【问题讨论】:

  • 在类别下拉列表中您想添加更多选项..对吗?
  • 是的,我需要创建一个或多个值..
  • 以前有人做过吗?

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


【解决方案1】:

试试

<%= 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" %>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-04
    • 2013-09-07
    • 1970-01-01
    • 1970-01-01
    • 2011-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多