Fix more hound warnings

This commit is contained in:
decabeza
2019-03-27 15:22:14 +01:00
parent e5bff01027
commit 91be3cf775
54 changed files with 776 additions and 476 deletions

View File

@@ -15,7 +15,8 @@ class Dashboard::PollsController < Dashboard::BaseController
def create
authorize! :manage_polls, proposal
@poll = Poll.new(poll_params.merge(author: current_user, related: proposal, stats_enabled: false))
@poll = Poll.new(poll_params.merge(author: current_user, related: proposal,
stats_enabled: false))
if @poll.save
redirect_to proposal_dashboard_polls_path(proposal), notice: t("flash.actions.create.poll")
else
@@ -32,7 +33,8 @@ class Dashboard::PollsController < Dashboard::BaseController
respond_to do |format|
if poll.update(poll_params)
format.html { redirect_to proposal_dashboard_polls_path(proposal), notice: t("flash.actions.update.poll") }
format.html { redirect_to proposal_dashboard_polls_path(proposal),
notice: t("flash.actions.update.poll") }
format.json { respond_with_bip(poll) }
else
format.html { render :edit }
@@ -43,30 +45,30 @@ class Dashboard::PollsController < Dashboard::BaseController
private
def poll
@poll ||= Poll.includes(:questions).find(params[:id])
end
def poll
@poll ||= Poll.includes(:questions).find(params[:id])
end
def poll_params
params.require(:poll).permit(poll_attributes)
end
def poll_params
params.require(:poll).permit(poll_attributes)
end
def poll_attributes
[:name, :starts_at, :ends_at, :description,
:results_enabled, :stats_enabled,
questions_attributes: question_attributes]
end
def poll_attributes
[:name, :starts_at, :ends_at, :description, :results_enabled, :stats_enabled,
questions_attributes: question_attributes]
end
def question_attributes
[:id, :title, :author_id, :proposal_id, :_destroy, question_answers_attributes: question_answers_attributes]
end
def question_attributes
[:id, :title, :author_id, :proposal_id, :_destroy,
question_answers_attributes: question_answers_attributes]
end
def question_answers_attributes
[:id, :_destroy, :title, :description, :given_order, :question_id,
documents_attributes: documents_attributes]
end
def question_answers_attributes
[:id, :_destroy, :title, :description, :given_order, :question_id,
documents_attributes: documents_attributes]
end
def documents_attributes
[:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
end
def documents_attributes
[:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
end
end