Class: Comable::Page
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Comable::Page
- Extended by:
- FriendlyId
- Includes:
- Ransackable
- Defined in:
- app/models/comable/page.rb
Constant Summary collapse
- PREVIEW_SESSION_KEY =
:preview_page
Instance Method Summary collapse
Instance Method Details
#default_slug ⇒ Object
23 24 25 26 |
# File 'app/models/comable/page.rb', line 23 def default_slug id ||= self.class.maximum(:id).next "pages_#{id}" end |
#normalize_slug(string) ⇒ Object
28 29 30 |
# File 'app/models/comable/page.rb', line 28 def normalize_slug(string) normalize_friendly_id(string).presence || default_slug end |
#published? ⇒ Boolean
19 20 21 |
# File 'app/models/comable/page.rb', line 19 def published? published_at.present? && published_at <= Time.now end |