Class: Article

Inherits:
Noodall::Node
  • Object
show all
Extended by:
Noodall::Articles::Categories
Defined in:
app/models/article.rb

Instance Method Summary collapse

Methods included from Noodall::Articles::Categories

all_categories

Instance Method Details

#category_listObject



17
18
19
# File 'app/models/article.rb', line 17

def category_list
  categories.join(',')
end

#category_list=(string) ⇒ Object



13
14
15
# File 'app/models/article.rb', line 13

def category_list=(string)
  self.categories = string.to_s.split(',').map{ |t| t.strip.titlecase }.reject(&:blank?).compact.uniq
end


21
22
23
24
25
26
27
28
29
# File 'app/models/article.rb', line 21

def related_articles
  @related_articles ||= begin
    siblings
      .published
      .order('published_date DESC')
      .where(:tags => /(#{tags.join('|')})/i)
      .limit(3)
  end
end