ActiveAdmin上でCarrierWaveを使ってアップロード時にエラー
ActiveAdmin上でCarrierWaveを使ってアップロードしようとした時下記のようなエラーがでた
ActiveRecord::StatementInvalid (Mysql2::Error: Column 'image' cannot be null: INSERT INTO `goods` (`created_at`, `detail`, `image`, `status`, `title`, `updated_at`) VALUES ('2014-12-05 12:12:50', 'ふなっしー', NULL, 0, 'ふな氏', '2014-12-05 12:12:50')):
formに
:html => {:multipart => true}
を入れる事で解決
ActiveAdmin.register Goods do permit_params :title, :detail, :status, :image form :html => {:multipart => true} do |f| f.inputs "Details" do f.input :title f.input :detail item_type = { "在庫あり" => 0, "残りわずか" => 1, "売り切れ" => 2} f.input :status, :as => :select, :collection => item_type, :include_blank => false f.input :image, :image_preview => true end f.actions end end