ITADN

Bug: elasticsearch_rails ignores custom limit_key from JSON POST body in Rails

#886Closedpalytoxin 创建于 2026-03-17
invalid
P
palytoxincommented
### Disclaimer - [x] I am aware that this issue will be closed or converted to a discussion if the requested code is missing or invalid. ### Description Hi, after upgrading to pagy 43.4.0, we found that pagy(:elasticsearch_rails, collection) does not pick up a custom limit_key from a JSON POST request body. Environment: - Rails 8.0.2 - Ruby 3.4.7 - Pagy 43.4.0 Initializer: Pagy.options[:limit] = 20 Pagy.options[:limit_key] = :size Request body: { "page": 1, "size": 1 } Controller: collection = Model.pagy_search(search_params) @pagy, response = pagy(:elasticsearch_rails, collection) Expected: size=1 should be used as the page size. Actual: Pagy falls back to the default limit (20). It looks like Pagy::Request#resolve_limit reads from request.GET.merge(request.POST), but in Rails JSON API requests the controller params contains size while request.POST may not, so resolve_limit misses it.
关闭于 2026-03-17 5 条评论