diff --git a/CHANGELOG.md b/CHANGELOG.md index 4be8fc1..cf1c50f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Your contribution here. * [#175](https://github.com/slack-ruby/slack-ruby-bot-server/pull/175): Fix(activerecord): correctly check for database in rails 7.2+ - [@markokajzer](https://github.com/markokajzer). +* [#176](https://github.com/slack-ruby/slack-ruby-bot-server/pull/176): Deps: bump mongoid-scroll to 2.0 - [@markokajzer](https://github.com/markokajzer). ### 2.1.1 (2023/07/25) diff --git a/Gemfile b/Gemfile index 5962aab..b90e1e4 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ case ENV.fetch('DATABASE_ADAPTER', nil) when 'mongoid' then gem 'kaminari-mongoid' gem 'mongoid', ENV['MONGOID_VERSION'] || '~> 7.3.0' - gem 'mongoid-scroll', '~> 1.0.1' + gem 'mongoid-scroll', '~> 2.0' gem 'mongoid-shell' group :development, :test do diff --git a/lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb b/lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb index f03a2ae..824c395 100644 --- a/lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb +++ b/lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb @@ -16,9 +16,9 @@ def paginate_by_cursor(coll, _options) coll = coll.skip(params[:offset].to_i) if params.key?(:offset) size = (params[:size] || 10).to_i coll = coll.limit(size) - coll.scroll(params[:cursor]) do |record, next_cursor| + coll.scroll(params[:cursor]) do |record, iterator| results[:results] << record if record - results[:next] = next_cursor.to_s + results[:next] = iterator.next_cursor.to_s break if results[:results].count >= size end results[:total_count] = coll.count if params[:total_count] && coll.respond_to?(:count)