0

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

1 に答える 1

0

おそらくそれを行うにはJavascriptが必要です

于 2013-05-21T06:28:12.203 に答える