我正在使用 activeadmin 做一个站点。我已经设置了所有必要的字段,并使用回形针设置了表单。我的字段适用于其他资源,并且我的资源模型已设置。
当我在 activeadmin 中将新资源添加到后面时,我可以保存它,但是当您在后端查看它时,我的字段为空。该模型也设置正确。
模型:
class Spotlight < ActiveRecord::Base
has_attached_file :image, styles: {
large: "600x450#",
medium: "250x250#",
small: "100x100#"
}, :default_url => "/images/:style/filler.png"
end
activeadmin Spotlight.rb
ActiveAdmin.register Spotlight do
form do |f|
f.inputs do
f.input :video
f.input :image
f.input :description
end
f.buttons
end
controller do
def permitted_params
params.permit(:spotlights => [:video, :image, :description])
end
end
end
ID 8 描述 空视频 空图像 图像
这是一个常见的问题吗?
干杯