From bb58fc003b5d9ac521a89e7f37c0b7fc1d45a4c9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 17 Apr 2018 13:50:48 +0200 Subject: [PATCH] Fix warning about using SQL in order for Account#partitioned (#7159) --- app/models/account.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/account.rb b/app/models/account.rb index 05e817f63..a3436b47c 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -114,7 +114,7 @@ class Account < ApplicationRecord scope :without_followers, -> { where(followers_count: 0) } scope :with_followers, -> { where('followers_count > 0') } scope :expiring, ->(time) { remote.where.not(subscription_expires_at: nil).where('subscription_expires_at < ?', time) } - scope :partitioned, -> { order('row_number() over (partition by domain)') } + scope :partitioned, -> { order(Arel.sql('row_number() over (partition by domain)')) } scope :silenced, -> { where(silenced: true) } scope :suspended, -> { where(suspended: true) } scope :recent, -> { reorder(id: :desc) }