1
0
Fork 0
forked from fedi/mastodon
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 Remove WebP support (#11589) 2019-08-17 22:04:15 +02:00
account_counters.rb Add tootctl cache recount command (#11597) 2019-08-18 14:55:03 +02:00
account_finder_concern.rb Search account domain in lowercase (#13016) 2020-02-01 15:42:24 +01:00
account_header.rb Remove WebP support (#11589) 2019-08-17 22:04:15 +02:00
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 Add an LDAP Mail attribute config (#12053) 2019-12-01 18:52:21 +01:00
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 Fix LDAP/PAM/SAML/CAS users not being approved instantly (#10621) 2019-04-25 02:49:25 +02:00
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 Refactor StatusThreadingConcern (#9626) 2020-01-11 19:55:33 +09:00
user_roles.rb Add moderation API (#9387) 2019-06-20 02:52:34 +02:00