Formtastic Datalist Activeadmin不保存

时间:2015-06-09 19:38:23

标签: ruby-on-rails activeadmin datalist formtastic

我正在使用activeadmin gem formtastic我想在特定文本字段中添加 datalist

resetForm()

在我保存并检查控制台后,我得到#FILE app/admin/model.rb ActiveAdmin.register Model do permit_params :title, :article_headline_a_id, :article_headline_b_id form(html: { multipart: true }) do |f| f.input :article_headline_a_id, :as => :datalist, :collection => Article.pluck(:title) f.input :article_headline_b_id, :as => :datalist, :collection => Article.pluck(:title) f.actions end end 而不是预期的ID号,一切似乎都能正常工作。

article_a_id = 0

1 个答案:

答案 0 :(得分:2)

听起来你没有将ID映射到标题试试:

    f.input :article_headline_a_id, :as => :datalist, :collection => Article.pluck(:title, :id)