-
- Downloads
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: - 552e886b - b63ede50 - 64ef37b8 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.
Showing
- app/controllers/api/v1/admin/accounts_controller.rb 1 addition, 1 deletionapp/controllers/api/v1/admin/accounts_controller.rb
- app/controllers/api/v1/admin/reports_controller.rb 1 addition, 1 deletionapp/controllers/api/v1/admin/reports_controller.rb
- app/controllers/api/v1/bookmarks_controller.rb 1 addition, 1 deletionapp/controllers/api/v1/bookmarks_controller.rb
- app/controllers/api/v1/conversations_controller.rb 1 addition, 1 deletionapp/controllers/api/v1/conversations_controller.rb
- app/controllers/api/v1/crypto/encrypted_messages_controller.rb 1 addition, 1 deletion...ontrollers/api/v1/crypto/encrypted_messages_controller.rb
- app/controllers/api/v1/favourites_controller.rb 1 addition, 1 deletionapp/controllers/api/v1/favourites_controller.rb
- app/controllers/api/v1/scheduled_statuses_controller.rb 1 addition, 1 deletionapp/controllers/api/v1/scheduled_statuses_controller.rb
- app/controllers/concerns/cache_concern.rb 1 addition, 1 deletionapp/controllers/concerns/cache_concern.rb
- app/models/account_conversation.rb 2 additions, 2 deletionsapp/models/account_conversation.rb
- app/models/concerns/paginable.rb 3 additions, 3 deletionsapp/models/concerns/paginable.rb
Please register or sign in to comment