This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/app/models/concerns
Akihiko Odaki ae871c4d46
Make Array-creation behavior of Paginable more predictable (#14687)
* Make Array-creation behavior of Paginable more predictable

Paginable.paginate_by_id usually returns ActiveRecord::Relation, but it
returns an Array if min_id option is present. The behavior caused problems
fixed with the following commits:
- 552e886b64
- b63ede5005
- 64ef37b89d

To prevent from recurring similar problems, this commit introduces two
changes:
- The scope now always returns an Array whether min_id option is present
  or not.
- The scope is renamed to to_a_paginated_by_id to clarify it returns an
  Array.

* Transform Paginable.to_a_paginated_by_id from a scope to a class method

https://api.rubyonrails.org/classes/ActiveRecord/Scoping/Named/ClassMethods.html#method-i-scope
> The method is intended to return an ActiveRecord::Relation object, which
> is composable with other scopes.

Paginable.to_a_paginated_by_id returns an Array and is not appropriate
as a scope.
2020-08-31 12:47:09 +02:00
..
account_associations.rb Add E2EE API (#13820) 2020-06-02 19:24:53 +02:00
account_avatar.rb
account_counters.rb
account_finder_concern.rb Search account domain in lowercase (#13016) 2020-02-01 15:42:24 +01:00
account_header.rb
account_interactions.rb Add user notes on accounts (#14148) 2020-06-30 19:19:50 +02:00
attachmentable.rb Fix remote files not using Content-Type header, streaming (#14184) 2020-06-30 23:58:02 +02:00
cacheable.rb
domain_normalizable.rb Fix admin page crashing when trying to block an invalid domain name (#13884) 2020-06-01 03:47:20 +02:00
expireable.rb
ldap_authenticable.rb
omniauthable.rb Fix rubocop warning (#14288) 2020-07-14 19:05:07 +02:00
paginable.rb Make Array-creation behavior of Paginable more predictable (#14687) 2020-08-31 12:47:09 +02:00
pam_authenticable.rb
rate_limitable.rb Add specific rate limits for posting and following (#13172) 2020-03-08 15:17:39 +01:00
redisable.rb
relationship_cacheable.rb
remotable.rb Fix movie width and frame_rate returning nil (#14357) 2020-07-19 22:28:27 +02:00
status_threading_concern.rb
user_roles.rb