Module: Decidim::Consultations::PublicableResults

Extended by:
ActiveSupport::Concern
Included in:
Decidim::Consultation
Defined in:
app/models/concerns/decidim/consultations/publicable_results.rb

Overview

This concern contains the logic related to results publication and promotion.

Instance Method Summary collapse

Instance Method Details

#publish_results!Object

Public: Publishes the results of the given component

Returns true if the record was properly saved, false otherwise.



38
39
40
# File 'app/models/concerns/decidim/consultations/publicable_results.rb', line 38

def publish_results!
  update!(results_published_at: Time.current)
end

#results_published?Boolean

Public: Checks whether the record has its results published or not.

Returns true if published, false otherwise.

Returns:

  • (Boolean)


30
31
32
# File 'app/models/concerns/decidim/consultations/publicable_results.rb', line 30

def results_published?
  results_published_at.present?
end

#unpublish_results!Object

Public: Unpublishes the results

Returns true if the record was properly saved, false otherwise.



46
47
48
# File 'app/models/concerns/decidim/consultations/publicable_results.rb', line 46

def unpublish_results!
  update!(results_published_at: nil)
end