ギャラリー モデルの 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