Sha256: 9e636dec1b57c1718e56c8e3550391f579a8095e7aacda041b297eb43ea7343c
Contents?: true
Size: 1.03 KB
Versions: 31
Compression:
Stored size: 1.03 KB
Contents
require 'survey_gizmo/api/question' module SurveyGizmo::API class Page include SurveyGizmo::Resource include SurveyGizmo::MultilingualTitle attribute :id, Integer attribute :description, String attribute :properties, Hash attribute :after, Integer attribute :survey_id, Integer attribute :questions, Array[Question] @route = '/survey/:survey_id/surveypage' def survey @survey ||= Survey.first(id: survey_id) end def questions @questions.each { |q| q.attributes = children_params } return @questions if @questions.all? { |q| q.sub_question_skus.all? { |sku| @questions.find { |q| q.id == sku } } } # See note on broken subquestions in resource.rb. with_subquestions = @questions @questions.each do |q| with_subquestions.reject! { |q| q.sub_question_skus.include?(q.id) } with_subquestions += q.sub_questions end @questions = with_subquestions.each { |q| q.attributes = children_params } end end end
Version data entries
31 entries across 31 versions & 1 rubygems