Class: Rtcl::Article
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Rtcl::Article
- 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
- #byline ⇒ Object
- #colors ⇒ Object
- #language_code ⇒ Object
- #summary ⇒ Object
- #time_since_created ⇒ Object
Instance Method Details
#byline ⇒ Object
33 34 35 |
# File 'app/models/rtcl/article.rb', line 33 def "by #{.name}" end |
#colors ⇒ Object
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..include? tag.strip end "base" end |
#language_code ⇒ Object
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 |
#summary ⇒ Object
28 29 30 31 |
# File 'app/models/rtcl/article.rb', line 28 def summary "#{truncate(content)}" if excerpt.nil? excerpt end |
#time_since_created ⇒ Object
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 |