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



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

alias_attribute :_list_item_subtitle, :published_at

#by_categoryObject

Scopes



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

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

#canonical_urlObject



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

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

#categoriesObject

Relations



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

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

#excerpt_htmlObject



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

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

#hexObject



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

def hex
  int_id.to_s(16)
end

#int_idObject

Autoinc



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

field :int_id, type: Integer

#meta_descriptionObject



42
43
44
# File 'app/models/journal_post.rb', line 42

def meta_description
  _meta_description.presence || excerpt_text
end

#template_nameObject

Attributes



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

field :template_name, default: "show"