Class: Blogrrr::Article

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/blogrrr/article.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#author_name ⇒ Object

Returns the value of attribute author_name.



3
4
5
# File 'app/models/blogrrr/article.rb', line 3

def author_name
  @author_name
end

Instance Method Details

#tag_list ⇒ Object



11
12
13
# File 'app/models/blogrrr/article.rb', line 11

def tag_list
  tags.join(", ")
end

#tag_list=(tags_string) ⇒ Object



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

def tag_list=(tags_string)
  tag_names = tags_string.split(",").collect{|s| s.strip.downcase}.uniq
  new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }
  self.tags = new_or_found_tags
end