I am trying to query any Company in my database where the field visible is either NULL or true. Here is what I found on a Stackoverflow post:
@companies = Company.where('visible=? OR visible=?', nil, true).page(params[:page]).per(10) Somehow though, this does not seem to work for querying nil. When I use this code, displaying all companies where visible is nil works very well though.
@companies = Company.where('visible' => nil).page(params[:page]).per(10) I would very much appreciate any ideas here.
Thanks!
EDIT:
This still displays only companies where visible is nil:
@companies = Company.where('visible is ? OR visible=?', nil, true).page(params[:page]).per(10)