我使用活動管理員,我需要上傳帶有大量圖像的圖庫。我該怎麼做? 我的代碼:使用回形針主動管理多個文件/圖像上傳
class Gallery < ActiveRecord::Base
belongs_to :event
has_many :images
attr_accessible :name, :publish, :images, :image, :images_attributes
accepts_nested_attributes_for :images, allow_destroy: true
validates :name, presence: true
end
class Image < ActiveRecord::Base
belongs_to :gallery
attr_accessible :url
has_attached_file :url, :styles => { :medium => "300x300>", :thumb => "100x100>" }
end
ActiveAdmin.register Gallery do
form html: { multipart: true } do |f|
f.inputs do
f.input :name
f.input :images, as: :file, input_html: { multiple: true}
end
f.buttons
end
end
而且我有這樣的錯誤:
Image(#70319146544460) expected, got ActionDispatch::Http::UploadedFile(#70319105893880)
哪一行會引發錯誤? – Agis 2012-10-21 12:12:56
我有同樣的問題。你有沒有解決這個問題呢? – Daniel 2013-03-25 12:02:52