I have a scope on my User model that gets users by country
scope :canada, where(:country => 'Canada')
If someone new signs up they’re showing up at the bottom of the list, but I want to put them at the top. I tried to do this, thinking Rails had some built-in way to change order
scope :canada, where(:country => 'Canada').order('DESC')
but I got this error message
SQLite3::SQLException: no such column: DESC: SELECT "users".* FROM "users" WHERE "users"."country" = 'Canada' ORDER BY DESC
Any suggestions?
You should specify an actual column name to sort on.
Or maybe you need just to sort on
created_atOr, if you want canadian records to be on top, and other records in unspecified order, you can try this: