Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 problem in my form's input

like image 642
user Avatar asked May 12 '16 15:05

user


Video Answer


1 Answers

Use

f.input :important, as: :boolean

Instead.

EDIT

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

like image 175
Leonel Galán Avatar answered Sep 30 '22 13:09

Leonel Galán