booleans in rails with sqlite

后端 未结 2 2028
醉话见心
醉话见心 2021-02-08 22:22

I am a bit of a noob still with rails, but I am running across something that seems a bit odd. I added a boolean field to a model in the database thusly

t.column         


        
2条回答
  •  名媛妹妹
    2021-02-08 23:00

    The problem may be with the database migration. I don't think that :bool is the right data type name to use. Try :boolean instead, e.g.

    t.column :admin, :boolean, :default => false, :null => false
    

提交回复
热议问题