Fix stupidity in last filter of liquid #1235
This commit is contained in:
parent
8b357a118d
commit
595e60fb9c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue