ruby on rails - active admin image field is shown dirty -
i using activeadmin gem admin console in ror application. in activeadmin model-featuredevent have declared form creating featured event. featuredevent model image field tried writing it. says nomethoderror in admin::featuredevents#new undefined method `new' nil:nilclass. following activeadmin model:
activeadmin.register featuredevent permit_params permitted = [:name, :location, :start_time, :description,:image,:phone, :email, :event_url, :active, :free, :image, :s3_credentials] permitted << :other if params[:action] == 'create' permitted end controller def create byebug @featuredevent = event.new(permitted_params[:featuredevent]) if @featuredevent.save redirect_to '/admin/featured_events#index' else flash[:message] = 'error in creating image.' end end def event_params params.require(:event).permit(:name, :location, :start_time, :description,:image,:phone, :email, :event_url, :active, :free, :image, :s3_credentials) end end form |f| inputs 'create private events' input :image end actions button_to 'create', featured_speakers_path(:featuredevent), method: :post #link_to 'create', {:controller => 'events', :action => 'create'}, {:method => :post } end end end
error in browser on navigating create featured event:
**nomethoderror in admin::featuredevents#new** undefined method `dirty?' nil:nilclass
ok got it. paperclip needs different name attachment declaration in featuredevent model [i have other model in image used ]. thank vishal
Comments
Post a Comment