[英]Rails pagy route without pagination
You can pass a flag as query params and based on input you can set/ignore pagination您可以将标志作为查询参数传递,并根据输入设置/忽略分页
it would be able to work with an extra param, in this case we will use params[:show_all]
它可以使用额外的参数,在这种情况下我们将使用
params[:show_all]
def index
unless params[:show_all]
@pagy, @products = pagy(Product.kept, items: page_size, page: page_number)
render json: @products
else
Product.kept
end
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.