Don't allow to modify questions for started polls
Adding, modifiying, and/or deleting questions for an already started poll is far away from being democratic and can lead to unwanted side effects like missing votes in the results or stats. So, from now on, only modifiying questions will be possible only if the poll has not started yet.
This commit is contained in:
committed by
Javi Martín
parent
d499a6944e
commit
8a26954bc5
@@ -3,7 +3,8 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
|
||||
include Translatable
|
||||
|
||||
load_and_authorize_resource :poll
|
||||
load_and_authorize_resource :question, class: "Poll::Question"
|
||||
load_resource class: "Poll::Question"
|
||||
authorize_resource except: [:new, :index]
|
||||
|
||||
def index
|
||||
@polls = Poll.not_budget
|
||||
@@ -17,6 +18,8 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
|
||||
proposal = Proposal.find(params[:proposal_id]) if params[:proposal_id].present?
|
||||
@question.copy_attributes_from_proposal(proposal)
|
||||
@question.poll = @poll
|
||||
|
||||
authorize! :create, @question
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
Reference in New Issue
Block a user