I'm new ruby and ruby on rails. I want image upload with active admin
I follow this code
app\admin\book.rb
ActiveAdmin.register Book do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
permit_params :list, :of, :attributes, :on, :model
#
# or
#
# permit_params do
# permitted = [:permitted, :attributes]
# permitted << :other if resource.something?
# permitted
# end
index do
column :name
column :image
column :author
column :genre
column :price
actions
end
form :html => { :enctype => "multipart/form-data" } do |f|
f.inputs "Details" do
f.input :image, :as => :file, :hint => f.template.image_tag(f.object.image.url(:medium))
f.input :author
f.input :name
end
f.actions
end
end
And
app\models\book.rb
class Book < ActiveRecord::Base
belongs_to :author
belongs_to :genre
has_attached_file :image, :styles => { :medium => "238x238>",
:thumb => "100x100>"
}
end
Yes i see file upload button in create page. But don't save form.