Module: Publishable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Cambium::Page
- Defined in:
- app/models/concerns/publishable.rb
Instance Method Summary collapse
- #formatted_active_date ⇒ Object
- #formatted_active_time ⇒ Object
- #formatted_date(date) ⇒ Object
- #formatted_inactive_date ⇒ Object
- #formatted_inactive_time ⇒ Object
- #publish! ⇒ Object
-
#published? ⇒ Boolean
——————————— Instance Methods.
Instance Method Details
#formatted_active_date ⇒ Object
30 31 32 |
# File 'app/models/concerns/publishable.rb', line 30 def formatted_active_date formatted_date(active_at) end |
#formatted_active_time ⇒ Object
43 44 45 46 |
# File 'app/models/concerns/publishable.rb', line 43 def formatted_active_time return '' if active_at.nil? active_at.strftime("%l:%M %p") end |
#formatted_date(date) ⇒ Object
38 39 40 41 |
# File 'app/models/concerns/publishable.rb', line 38 def formatted_date(date) return '' if date.nil? date.strftime("%d %B, %Y") end |
#formatted_inactive_date ⇒ Object
34 35 36 |
# File 'app/models/concerns/publishable.rb', line 34 def formatted_inactive_date formatted_date(inactive_at) end |
#formatted_inactive_time ⇒ Object
48 49 50 51 |
# File 'app/models/concerns/publishable.rb', line 48 def formatted_inactive_time return '' if inactive_at.nil? inactive_at.strftime("%l:%M %p") end |
#publish! ⇒ Object
53 54 55 |
# File 'app/models/concerns/publishable.rb', line 53 def publish! update_column :active_at, Time.now end |
#published? ⇒ Boolean
——————————— Instance Methods
24 25 26 27 28 |
# File 'app/models/concerns/publishable.rb', line 24 def published? return false if active_at.nil? (active_at <= Time.now and inactive_at == nil) or (active_at <= Time.now and inactive_at >= Time.now) end |