diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 14 | ||||
-rw-r--r-- | app/models/concerns/paginable.rb | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 798042b3b..03584b4e6 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -75,12 +75,12 @@ class Account < ApplicationRecord scope :by_domain_accounts, -> { group(:domain).select(:domain, 'COUNT(*) AS accounts_count').order('accounts_count desc') } delegate :email, - :current_sign_in_ip, - :current_sign_in_at, - :confirmed?, - to: :user, - prefix: true, - allow_nil: true + :current_sign_in_ip, + :current_sign_in_at, + :confirmed?, + to: :user, + prefix: true, + allow_nil: true def follow!(other_account) active_relationships.where(target_account: other_account).first_or_create!(target_account: other_account) @@ -329,7 +329,7 @@ class Account < ApplicationRecord private def follow_mapping(query, field) - query.pluck(field).inject({}) { |mapping, id| mapping[id] = true; mapping } + query.pluck(field).each_with_object({}) { |id, mapping| mapping[id] = true } end def avatar_styles(file) diff --git a/app/models/concerns/paginable.rb b/app/models/concerns/paginable.rb index b3df081c0..9e95cd649 100644 --- a/app/models/concerns/paginable.rb +++ b/app/models/concerns/paginable.rb @@ -4,7 +4,7 @@ module Paginable extend ActiveSupport::Concern included do - scope :paginate_by_max_id, -> (limit, max_id = nil, since_id = nil) { + scope :paginate_by_max_id, ->(limit, max_id = nil, since_id = nil) { query = order(arel_table[:id].desc).limit(limit) query = query.where(arel_table[:id].lt(max_id)) unless max_id.blank? query = query.where(arel_table[:id].gt(since_id)) unless since_id.blank? |