I need to capture new collection from the object that running in the loop.
I already try this, but don't return array.
If @categories = ['1','2','3']
the new_collection has = "123"
---------------
VIEW
---------------
{% for cat in categories %}
---> {% capture new_collection %} {{
cat.id | category_children:'1', }} {% endcapture %} <---
{% for attr in new_collection %}
<p> attr ID: {{
attr.id }} </p>
{% endfor %}
------------------
LiquidFilter
------------------
def category_children(id, depth = nil)
if depth == nil
@categories = Imentore::Category.find(id).descendants.collect{|category| Imentore::CategoryDrop.new(category)}
else
@categories = Imentore::Category.find(id).descendants(to_depth: depth.to_i)
end
@categories
end