Try changing
f.input :benefit_image
to
f.input :image, :required => false, :as => :file
Question
I'm trying to use active admin gem with paperclip. I'm new to Ruby and i think this is possible. Please dont vote this question down if I'm wrong.
My active admin's user_benefit file is as follows
ActiveAdmin.register UserBenefit do
menu priority: 7
permit_params :available_benefit
index do
selectable_column
default_actions
column :id
column :available_benefit
column :created_at
end
form do |f|
f.inputs "User Benefit Details" do
f.input :available_benefit
f.input :benefit_image
end
f.actions
end
end
my model is
class UserBenefit < ActiveRecord::Base
has_attached_file :benefit_image, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :benefit_image, :content_type => /\Aimage\/.*\Z/
end
when i'm trying to load the admin's page i'm getting an error.. wrong number of arguments (1 for 0)
Please help
La solution
Try changing
f.input :benefit_image
to
f.input :image, :required => false, :as => :file