allow drops to optimize loading a slice of elements

This commit is contained in:
Tom Burns
2013-11-24 12:29:15 -05:00
parent f015d804ea
commit cf49b06ccc
2 changed files with 53 additions and 2 deletions

View File

@@ -75,8 +75,11 @@ module Liquid
limit = context[@attributes['limit']]
to = limit ? limit.to_i + from : nil
segment = Utils.slice_collection_using_each(collection, from, to)
segment = if (from != 0 || to != nil) && collection.respond_to?(:load_slice)
collection.load_slice(from, to)
else
Utils.slice_collection_using_each(collection, from, to)
end
return render_else(context) if segment.empty?