Class: Blog

Inherits:
Section
  • Object
show all
Defined in:
app/models/blog.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.content_typesObject



10
11
12
# File 'app/models/blog.rb', line 10

def content_types
  %w(Article)
end

Instance Method Details

#archive_monthsObject



15
16
17
# File 'app/models/blog.rb', line 15

def archive_months
  article_counts_by_month.transpose.first
end

#article_counts_by_monthObject



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_monthObject



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_yearObject



23
24
25
# File 'app/models/blog.rb', line 23

def articles_by_year
  @articles_by_year ||= articles.published.group_by(&:published_year)
end


31
32
33
# File 'app/models/blog.rb', line 31

def nav_children
  categories.roots
end