我的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
答案 0 :(得分:0)
你可能需要Javascript才能做到这一点