Class: JournalPost
- Inherits:
-
Object
- Object
- JournalPost
- Includes:
- Ants::Content, Ants::Featurable, Ants::SortedRelations, Mongoid::Autoinc
- Defined in:
- app/models/journal_post.rb
Instance Method Summary collapse
-
#_list_item_subtitle ⇒ Object
Helpers.
-
#by_category ⇒ Object
Scopes.
- #canonical_url ⇒ Object
-
#categories ⇒ Object
Relations.
- #excerpt_html ⇒ Object
- #hex ⇒ Object
-
#int_id ⇒ Object
Autoinc.
- #meta_description ⇒ Object
-
#template_name ⇒ Object
Attributes.
Instance Method Details
#_list_item_subtitle ⇒ Object
Helpers
28 |
# File 'app/models/journal_post.rb', line 28 alias_attribute :_list_item_subtitle, :published_at |
#by_category ⇒ Object
Scopes
19 |
# File 'app/models/journal_post.rb', line 19 scope :by_category, -> (id) { where(:category_ids.in => [id]) } |
#canonical_url ⇒ Object
38 39 40 |
# File 'app/models/journal_post.rb', line 38 def canonical_url "#{protocole}#{host}#{path}" end |
#categories ⇒ Object
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_html ⇒ Object
34 35 36 |
# File 'app/models/journal_post.rb', line 34 def excerpt_html body_html.split('<!-- -->').first || '' end |
#hex ⇒ Object
30 31 32 |
# File 'app/models/journal_post.rb', line 30 def hex int_id.to_s(16) end |
#int_id ⇒ Object
Autoinc
11 |
# File 'app/models/journal_post.rb', line 11 field :int_id, type: Integer |
#meta_description ⇒ Object
42 43 44 |
# File 'app/models/journal_post.rb', line 42 def .presence || excerpt_text end |
#template_name ⇒ Object
Attributes
8 |
# File 'app/models/journal_post.rb', line 8 field :template_name, default: "show" |