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
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
..
chewy
controllers Make Array-creation behavior of Paginable more predictable (#14687) 2020-08-31 12:47:09 +02:00
helpers
javascript
lib Add support for dereferencing objects through bearcaps (#14683) 2020-08-30 12:34:20 +02:00
mailers
models Make Array-creation behavior of Paginable more predictable (#14687) 2020-08-31 12:47:09 +02:00
policies
presenters
serializers
services Fix inefficiencies in fan-out-on-write service (#14682) 2020-08-30 12:33:59 +02:00
validators
views
workers