activeadminformtastic

ActiveAdmin save value from checkbox as boolean


I want to save value from my checkbox's form as boolean, but i have got an array

Chunk of my log "important"=>[""]

or if i checked it

"important"=>["", "true"]

my table

t.boolean :important, :default => false

my form

f.input :important, :as => :check_boxes, collection: [true]

How to fix it?

I think the problem is in my form's input


Solution

  • Use

    f.input :important, as: :boolean
    

    Instead. Source - see Formtastic’s documentation which ActiveAdmin is based upon.

    EDIT

    as: :check_boxes is meant for collections (selecting many values from a collection).