]> cat aescling's git repositories - mastodon.git/commitdiff
Using "rails style" order arguments
authorKurtis Rainbolt-Greene <me@kurtisrainboltgreene.name>
Sun, 8 Jan 2017 01:55:40 +0000 (17:55 -0800)
committerGitHub <noreply@github.com>
Sun, 8 Jan 2017 01:55:40 +0000 (17:55 -0800)
app/models/account.rb

index 5c1f6e7c1cca3cdf229b0b2d338f3ddb48133a84..41fcc864b37daf77e27d220d2126f971666e6196 100644 (file)
@@ -62,8 +62,8 @@ class Account < ApplicationRecord
   scope :expiring, ->(time) { where(subscription_expires_at: nil).or(where('subscription_expires_at < ?', time)).remote.with_followers }
   scope :silenced, -> { where(silenced: true) }
   scope :suspended, -> { where(suspended: true) }
-  scope :recent, -> { reorder('id desc') }
-  scope :alphabetic, -> { order('domain ASC, username ASC') }
+  scope :recent, -> { reorder(id: :desc) }
+  scope :alphabetic, -> { order(domain: :asc, username: :asc) }
 
   def follow!(other_account)
     active_relationships.where(target_account: other_account).first_or_create!(target_account: other_account)