Polls in the dashboard

A reduced version of polls has been added to the dashboard
This commit is contained in:
Juan Salvador Pérez García
2018-06-26 08:05:38 +02:00
parent bafdd697b8
commit 2ce9f95283
24 changed files with 463 additions and 37 deletions

View File

@@ -20,6 +20,8 @@ class Poll::Question < ActiveRecord::Base
validates :title, length: { minimum: 4 }
accepts_nested_attributes_for :question_answers, reject_if: :all_blank, allow_destroy: true
scope :by_poll_id, ->(poll_id) { where(poll_id: poll_id) }
scope :sort_for_list, -> { order('poll_questions.proposal_id IS NULL', :created_at)}