Module: Decidim::Publicable
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 'lib/decidim/publicable.rb', line 37 def publish! update_attributes!(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 '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 'lib/decidim/publicable.rb', line 45 def unpublish! update_attributes!(published_at: nil) end |