Skip to content

Instantly share code, notes, and snippets.

@JunichiIto
Created December 5, 2013 03:59
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 JunichiIto/7799880 to your computer and use it in GitHub Desktop.
Save JunichiIto/7799880 to your computer and use it in GitHub Desktop.
An example code for not and reverse_order.
Contractor.where.not(name: nil).order(:created_at).reverse_order.to_sql
# => "SELECT \"contractors\".* FROM \"contractors\" WHERE (\"contractors\".\"name\" IS NOT NULL) ORDER BY \"contractors\".\"created_at\" DESC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment