0
我已經active_admin形式爲我的畫廊模式: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