Module: Decidim::Publicable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Feature, ParticipatoryProcess
- Defined in:
- decidim-core/lib/decidim/publicable.rb
Overview
This concern contains the logic related to publication and promotion.
Instance Method Summary collapse
-
#publish! ⇒ Object
Public: Publishes this feature.
-
#published? ⇒ Boolean
Public: Checks whether the record has been published or not.
-
#unpublish! ⇒ Object
Public: Unpublishes this feature.
Instance Method Details
#publish! ⇒ Object
Public: Publishes this feature
Returns true if the record was properly saved, false otherwise.
37 38 39 |
# File 'decidim-core/lib/decidim/publicable.rb', line 37 def publish! update_attribute(:published_at, Time.current) end |
#published? ⇒ Boolean
Public: Checks whether the record has been published or not.
Returns true if published, false otherwise.
29 30 31 |
# File 'decidim-core/lib/decidim/publicable.rb', line 29 def published? published_at.present? end |
#unpublish! ⇒ Object
Public: Unpublishes this feature
Returns true if the record was properly saved, false otherwise.
45 46 47 |
# File 'decidim-core/lib/decidim/publicable.rb', line 45 def unpublish! update_attribute(:published_at, nil) end |