Class: Rtcl::Article

Inherits:
ApplicationRecord show all
Includes:
Polivalente::Archivable, Polivalente::Commentable, Polivalente::ContentHashable, Polivalente::Reactable, Polivalente::Sortable, Polivalente::Taggable, Polivalente::Trashable, Polivalente::Visibility
Defined in:
app/models/rtcl/article.rb

Instance Method Summary collapse

Instance Method Details

#bylineObject



33
34
35
# File 'app/models/rtcl/article.rb', line 33

def 
  "by #{author.name}"
end

#colorsObject



45
46
47
48
49
50
51
# File 'app/models/rtcl/article.rb', line 45

def colors
  tag_list.split(',').each do |tag|
    return tag if Rtcl.config.supported_tags.include? tag.strip
  end

  "base"
end

#language_codeObject



41
42
43
# File 'app/models/rtcl/article.rb', line 41

def language_code
  LanguageList::LanguageInfo.find(language).iso_639_1.inspect.gsub(/\"/i, '') unless self.new_record?
end

#summaryObject



28
29
30
31
# File 'app/models/rtcl/article.rb', line 28

def summary
  "#{truncate(content)}" if excerpt.nil?
  excerpt
end

#time_since_createdObject



37
38
39
# File 'app/models/rtcl/article.rb', line 37

def time_since_created
  ActionController::Base.helpers.distance_of_time_in_words(Time.now, created_at)
end