Class: Blog
- Inherits:
-
Section
- Object
- Section
- Blog
- Defined in:
- app/models/blog.rb
Class Method Summary collapse
Instance Method Summary collapse
- #archive_months ⇒ Object
- #article_counts_by_month ⇒ Object
- #articles_by_month ⇒ Object
- #articles_by_year ⇒ Object
- #nav_children ⇒ Object
Class Method Details
.content_types ⇒ Object
10 11 12 |
# File 'app/models/blog.rb', line 10 def content_types %w(Article) end |
Instance Method Details
#archive_months ⇒ Object
15 16 17 |
# File 'app/models/blog.rb', line 15 def archive_months article_counts_by_month.transpose.first end |
#article_counts_by_month ⇒ Object
19 20 21 |
# File 'app/models/blog.rb', line 19 def article_counts_by_month articles_by_month.map{|month, articles| [month, articles.size]} end |
#articles_by_month ⇒ Object
27 28 29 |
# File 'app/models/blog.rb', line 27 def articles_by_month @articles_by_month ||= articles.published.group_by(&:published_month) end |
#articles_by_year ⇒ Object
23 24 25 |
# File 'app/models/blog.rb', line 23 def articles_by_year @articles_by_year ||= articles.published.group_by(&:published_year) end |
#nav_children ⇒ Object
31 32 33 |
# File 'app/models/blog.rb', line 31 def nav_children categories.roots end |