All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
These are the latest changes on the project's master
branch that have not yet been released.
- Breaking change: Raised minimum required Ruby version to 2.7
- Breaking change: Raised minimum required
activerecord
version to 6.0
- Test against Ruby version 3.2
- Breaking change: Ensure timestamp
order_by
fields (likecreated_at
) will paginate results by honoring timestamp order down to microsecond resolution on comparison. This was done by changing the cursor logic for timestamp fields, which means that the cursors strings change from version 0.3.0 to 0.4.0 and old cursors cannot be decoded by the new gem version anymore.
- Add a
limit
param to paginator that can be used instead eitherfirst
orlast
- Add a
max_page_size
to the configuration, allowing to set a global limit to the page size (non overridable): Defaultnil
- Support explicitly requesting all columns via
.select(*)
without re-including the requested column
- Breaking change: Drop support for Ruby 2.5 (EOL 2021-03-31)
- Breaking change: Remove nesting of
ParameterError
andInvalidCursorError
errors, they are now directly nested under the main gem module. So they're nowRailsCursorPagination::ParameterError
andRailsCursorPagination::InvalidCursorError
. - Refactor paginator cursor interactions into exposed
RailsCursorPagination::Cursor
class - Require multi-factor-authentication to publish the gem on Rubygems
- Breaking change: The way records are retrieved from a given cursor has been changed to no longer use
CONCAT
but instead simply use a compoundWHERE
clause in case of a custom order and having both the custom field as well as theid
field in theORDER BY
query. This is a breaking change since it now changes the internal order of how records with the same value of theorder_by
field are returned. - Remove
ORDER BY
clause fromCOUNT
queries
- Only trigger one SQL query to load the records from the database and use it to determine if there was a previous / is a next page
- Memoize the
Paginator#page
method which is invoked multiple times to prevent it from mapping over therecords
again and again and rebuilding all cursors
- Description about
order_by
on arbitrary SQL to README.md
- Make the gem publicly available via github.com/xing/rails_cursor_pagination and release it to Rubygems.org
- Reference changelog file in the gemspec instead of the general releases Github tab
- Remove bulk from release: The previous gem releases contained files like the content of the
bin
folder or the Gemfile used for testing. Since this is not useful for gem users, adjust the gemspec file accordingly.
- Pagination for relations in which a custom
SELECT
does not contain cursor-relevant fields like:id
or the field specified viaorder_by
- Add support for handling
nil
fororder
andorder_by
values as if they were not passed
- Pagination for relations that use a custom
SELECT
- First version of the gem, including pagination, custom ordering by column and sort-order.