Skip to content

Instantly share code, notes, and snippets.

@hadrienblanc
Created September 6, 2020 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadrienblanc/1c54ef20ccfcc2dcb574bee72798fc51 to your computer and use it in GitHub Desktop.
Save hadrienblanc/1c54ef20ccfcc2dcb574bee72798fc51 to your computer and use it in GitHub Desktop.
# Returns nils and strings
Model.where(:url.ne => "").count
# Returns strings and ""
Model.where(:url.ne => nil).count
# Returns strings, nils and ""
Model.where(:url.ne => ["", nil]).count
Model.where(:url.nin => ["", nil]).count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment