【发布时间】:2017-07-29 10:08:01
【问题描述】:
根据activeamdin文档,我们可以这样做:
batch_action :flag, form: {
type: %w[Offensive Spam Other],
reason: :text,
notes: :textarea,
hide: :checkbox,
date: :datepicker
} do |ids, inputs|
# inputs is a hash of all the form fields you requested
redirect_to collection_path, notice: [ids, inputs].to_s
end
但是,上面的表单不是formtastic,不支持高级表格配置(设置表单窗口的大小)。有什么方法可以将其更改为格式格式,例如:
form do |f|
f.semantic_errors # shows errors on :base
f.inputs # builds an input field for every attribute
f.actions # adds the 'Submit' and 'Cancel' buttons
end
【问题讨论】:
标签: ruby-on-rails ruby activeadmin formtastic