Fix stupidity in last filter of liquid #1235

This commit is contained in:
Holger Just 2013-02-12 13:15:31 +01:00
parent 8b357a118d
commit 595e60fb9c
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ module ChiliProject
# Example: # Example:
# {{ product.images | last | to_img }} # {{ product.images | last | to_img }}
def last(array, count=nil) def last(array, count=nil)
array.last if count=nil? && array.respond_to?(:last) return array.last if count.nil? && array.respond_to?(:last)
if array.respond_to?(:[]) if array.respond_to?(:[])
count.to_i > 0 ? array[(count.to_i * -1)..-1] : [] count.to_i > 0 ? array[(count.to_i * -1)..-1] : []
end end