How can I match null in rails active record.
User.where(['id = ? and active = ? and activation_code = ?', params[:id], 0, NULL]).first
or
User.where(['id = ? and active = ? and activation_code = ?', params[:id], 0, nil]).first
Both are not working.
In Rails 4 you can do this:
User.where(id: params[:id], active: 0).where.not(activation_code: nil)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With