Class: Decidim::Surveys::Survey
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Surveys::Survey
- Includes:
- HasFeature
- Defined in:
- decidim-surveys/app/models/decidim/surveys/survey.rb
Overview
The data store for a Survey in the Decidim::Surveys component.
Instance Method Summary collapse
-
#answered_by?(user) ⇒ Boolean
Public: returns whether the survey is answered by the user or not.
-
#questions_editable? ⇒ Boolean
Public: returns whether the survey questions can be modified or not.
Instance Method Details
#answered_by?(user) ⇒ Boolean
Public: returns whether the survey is answered by the user or not.
20 21 22 |
# File 'decidim-surveys/app/models/decidim/surveys/survey.rb', line 20 def answered_by?(user) answers.where(user: user).count == questions.length end |
#questions_editable? ⇒ Boolean
Public: returns whether the survey questions can be modified or not.
15 16 17 |
# File 'decidim-surveys/app/models/decidim/surveys/survey.rb', line 15 def questions_editable? answers.empty? end |