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
Instance Method Details
#_list_item_subtitle ⇒ Object
Helpers
25 |
# File 'app/models/journal_post.rb', line 25 alias_attribute :_list_item_subtitle, :published_at |
#by_category ⇒ Object
Scopes
16 |
# File 'app/models/journal_post.rb', line 16 scope :by_category, -> (id) { where(:category_ids.in => [id]) } |
#canonical_url ⇒ Object
35 36 37 |
# File 'app/models/journal_post.rb', line 35 def canonical_url "#{protocole}#{host}#{path}" end |
#categories ⇒ Object
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_html ⇒ Object
31 32 33 |
# File 'app/models/journal_post.rb', line 31 def excerpt_html body_html.split('<!-- -->').first || '' end |
#hex ⇒ Object
27 28 29 |
# File 'app/models/journal_post.rb', line 27 def hex int_id.to_s(16) end |
#int_id ⇒ Object
Autoinc
8 |
# File 'app/models/journal_post.rb', line 8 field :int_id, type: Integer |
#meta_description ⇒ Object
39 40 41 |
# File 'app/models/journal_post.rb', line 39 def .presence || excerpt_text end |