Rubocop autocorrections

This commit is contained in:
Bertocq
2017-10-17 22:00:00 +02:00
parent ceec71e558
commit ce0a7f6fad
32 changed files with 101 additions and 111 deletions

View File

@@ -54,7 +54,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
end
def poll_params
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted, :summary, :description,
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted, :summary, :description,
geozone_ids: [],
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
end

View File

@@ -5,7 +5,7 @@ class Admin::Poll::Questions::Answers::ImagesController < Admin::Poll::BaseContr
end
def new
@answer = ::Poll::Question::Answer.find(params[:answer_id])
@answer = ::Poll::Question::Answer.find(params[:answer_id])
end
def create

View File

@@ -33,11 +33,11 @@ class Admin::Poll::Questions::Answers::VideosController < Admin::Poll::BaseContr
end
def destroy
if @video.destroy
notice = t("flash.actions.destroy.poll_question_answer_video")
else
notice = t("flash.actions.destroy.error")
end
notice = if @video.destroy
t("flash.actions.destroy.poll_question_answer_video")
else
t("flash.actions.destroy.error")
end
redirect_to :back, notice: notice
end

View File

@@ -49,7 +49,7 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
end
def shift_params
shift_params = params.require(:shift).permit(:booth_id, :officer_id, :task, date:[:vote_collection_date, :recount_scrutiny_date])
shift_params = params.require(:shift).permit(:booth_id, :officer_id, :task, date: [:vote_collection_date, :recount_scrutiny_date])
shift_params.merge(date: shift_params[:date]["#{shift_params[:task]}_date".to_sym])
end
end

View File

@@ -18,8 +18,7 @@ class DirectUploadsController < ApplicationController
render json: { cached_attachment: @direct_upload.relation.cached_attachment,
filename: @direct_upload.relation.attachment.original_filename,
destroy_link: render_destroy_upload_link(@direct_upload).html_safe,
attachment_url: @direct_upload.relation.attachment.url
}
attachment_url: @direct_upload.relation.attachment.url}
else
@direct_upload.destroy_attachment
render json: { errors: @direct_upload.errors[:attachment].join(", ") },
@@ -28,7 +27,7 @@ class DirectUploadsController < ApplicationController
end
def destroy
@direct_upload = DirectUpload.new(direct_upload_params.merge(user: current_user) )
@direct_upload = DirectUpload.new(direct_upload_params.merge(user: current_user))
@direct_upload.relation.set_attachment_from_cached_attachment
if @direct_upload.destroy_attachment