我的 Gallery 模型有 active_admin 表单:
form do |f|
f.inputs "Gallery" do
f.input :title
f.input :description
f.input :file
end
f.has_many :images do |ff|
ff.input :file
end
f.actions
end
如果我编辑画廊,它会向我显示图像文件上传的输入,但如果可能的话,我还想显示图像缩略图,例如:
f.has_many :images do |ff|
image_to ...
ff.input :file
end
知道我该怎么做吗?型号有:
class Image < ActiveRecord::Base
attr_accessible :gallery_id, :file
belongs_to :gallery
mount_uploader :file, FileUploader
end
class Gallery < ActiveRecord::Base
attr_accessible :description, :title, :file, :images_attributes
has_many :images
accepts_nested_attributes_for :images, allow_destroy: true
mount_uploader :file, FileUploader
end