Class: JournalPost

Inherits:
Object
  • Object
show all
Includes:
Ants::Content, Ants::Featurable, Ants::SortedRelations, Mongoid::Autoinc
Defined in:
app/models/journal_post.rb

Instance Method Summary collapse

Instance Method Details

#_list_item_subtitleObject

Helpers



25
# File 'app/models/journal_post.rb', line 25

alias_attribute :_list_item_subtitle, :published_at

#by_categoryObject

Scopes



16
# File 'app/models/journal_post.rb', line 16

scope :by_category, -> (id) { where(:category_ids.in => [id]) }

#canonical_urlObject



35
36
37
# File 'app/models/journal_post.rb', line 35

def canonical_url
  "#{protocole}#{host}#{path}"
end

#categoriesObject

Relations



12
# File 'app/models/journal_post.rb', line 12

has_and_belongs_to_many :categories, class_name: "JournalCategory", inverse_of: :posts, index: true

#excerpt_htmlObject



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

def excerpt_html
  body_html.split('<!-- -->').first || ''
end

#hexObject



27
28
29
# File 'app/models/journal_post.rb', line 27

def hex
  int_id.to_s(16)
end

#int_idObject

Autoinc



8
# File 'app/models/journal_post.rb', line 8

field :int_id, type: Integer

#meta_descriptionObject



39
40
41
# File 'app/models/journal_post.rb', line 39

def meta_description
  _meta_description.presence || excerpt_text
end