Class: Landable::Liquid::CategoriesDrop
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Landable::Liquid::CategoriesDrop
- Defined in:
- lib/landable/liquid/drops.rb
Overview
CategoryProxy gives us these:
categories.size }
for category in categories %
{{ category.name }}: {{ category.pages.size }} pages
endfor %
<h1>Blog posts</h1> <ul>
{% for page in categories.blog.pages %}
<li><a href="{{ page.url }}">{{ page.name }}</a></li>
{% endfor %}
</ul>
Instance Method Summary collapse
Instance Method Details
#before_method(method_name) ⇒ Object
24 25 26 |
# File 'lib/landable/liquid/drops.rb', line 24 def before_method method_name category_cache[method_name] ||= ::Landable::Category.find_by_slug method_name end |
#each(&block) ⇒ Object
32 33 34 |
# File 'lib/landable/liquid/drops.rb', line 32 def each &block ::Landable::Category.all.each &block end |
#size ⇒ Object
28 29 30 |
# File 'lib/landable/liquid/drops.rb', line 28 def size @size ||= Category.count end |