小编Sta*_*nmx的帖子

Paperclip + Active_admin + Rails 3.0.10多个图像

我有一个回形针和多个图像'我实现active_admin和产品更新很好,但是,我不能上传或编辑多个图像,我有的形式是这样的:

form :html => { :multipart => true } do |f|
  f.inputs "Details" do
    f.input :name
    f.input :created_at, :label => "Publish Product at"
    f.input :category
  end

  f.inputs "Images" do
    f.has_many :assets do |p|
      p.input :asset, :as => :file, :input_html => { :multiple => true }, :label => "Image", :hint => p.object.asset.nil? ? p.template.content_tag(:span, "No Image Yet") : p.template.image_tag(p.object.asset.url(:thumb))
      p.input :_destroy, :as=>:boolean, :required => false, :label=>'Remove'
    end
  end

  f.inputs "Content" do
    f.input :description
  end
  f.buttons
end
Run Code Online (Sandbox Code Playgroud)

和......

f.inputs "Images" do
    f.has_many …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails paperclip activeadmin

16
推荐指数
1
解决办法
4216
查看次数

标签 统计

activeadmin ×1

paperclip ×1

ruby-on-rails ×1