File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ module MeiliSearch
99 module Rails
1010 module Pagination
1111 class WillPaginate
12+
1213 def self . create ( results , total_hits , options = { } )
14+ total_hits = 0 if Utilities . null_object? ( total_hits )
15+ options [ :page ] = 1 if Utilities . null_object? ( options [ :page ] )
16+ options [ :per_page ] = 1 if Utilities . null_object? ( options [ :per_page ] )
17+
1318 ::WillPaginate ::Collection . create ( options [ :page ] , options [ :per_page ] , total_hits ) do |pager |
1419 pager . replace results
1520 end
Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ def sequel_model?(model_class)
5656 defined? ( ::Sequel ::Model ) && model_class < Sequel ::Model
5757 end
5858
59+ def null_object? ( obj )
60+ obj . is_a? NullObject
61+ end
62+
5963 private
6064
6165 def constraint_passes? ( record , constraint )
You can’t perform that action at this time.
0 commit comments