Skip to content

Instantly share code, notes, and snippets.

@orlando
Created March 6, 2012 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orlando/1989583 to your computer and use it in GitHub Desktop.
Save orlando/1989583 to your computer and use it in GitHub Desktop.
active admin handle many assets
f.inputs "Product images" do
f.has_many :assets do |p|
p.input :asset, :as => :file, :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 image'
end
end
f.inputs "Product details" do
f.input :category, :label => "Category", :hint => "Select one category"
f.input :height
f.input :width
f.input :depth
f.input :color, :label => "Color", :hint => "Select one color"
f.input :sku, :label => "SKU"
f.input :price
end
f.buttons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment