I validated the boolean column, but valid? Didn't become true, and it wasn't what I expected!
Therefore, I will summarize what I researched about boolean columns as a memorandum!
Bad pattern: Not null constraint contains false, so I thought I should do presence: true, so I did the following!
python
validates :check, presence: true
However, in this case, an error occurs when check = false!
After some research, I found that I needed to do the following!
python
validates :check, inclusion: {in: [true, false]}
Reference material https://qiita.com/mktakuya/items/a13c2175f0f0d9871038
Recommended Posts