File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,12 @@ def render(context)
37
37
@context = context
38
38
39
39
context . stack do
40
- collection = context [ @collection_name ]
41
- raise ::Liquid ::ArgumentError . new ( "Cannot paginate array '#{ @collection_name } '. Not found." ) if collection . nil?
40
+ collection = @ context[ @collection_name ] . presence || @context . environments [ 0 ] [ @collection_name ]
41
+ raise ::Liquid ::ArgumentError . new ( "Cannot paginate collection '#{ @collection_name } '. Not found." ) if collection . nil?
42
42
43
43
if collection . is_a? Array
44
44
paginated_collection = Kaminari . paginate_array ( collection . to_a ) . page ( current_page ) . per ( @page_size )
45
- elsif collection . respond_to? ( :page ) && collection . respond_to? ( :per )
45
+ elsif collection . respond_to? ( :page )
46
46
paginated_collection = collection . page ( current_page ) . per ( @page_size )
47
47
end
48
48
You can’t perform that action at this time.
0 commit comments