我正在使用Rails,HAML和simple_form,我正在尝试创建一个选项,如果在集合中找不到该项,则可以选择输入文本。这可能吗?它目前看起来像这样:
= simple_form_for [:admin, office] do |f|
= f.input :person,
label: "Select Person",
collection: People.all,
label_method: -> (person) { person.name },
input_html: { data: { plugin: "select2" } }
= f.submit "Set Person", class: "btn btn-primary btn-block"