Files
grecia/app/controllers/admin/poll/polls_controller.rb
Juanjo Bazán ef77dd039b adds preloading
2016-12-06 13:49:51 +01:00

39 lines
633 B
Ruby

class Admin::Poll::PollsController < Admin::BaseController
load_and_authorize_resource
def index
end
def show
@poll = Poll.includes(:questions, :booths, :officers).find(params[:id])
end
def new
end
def create
if @poll.save
redirect_to [:admin, @poll], notice: t("flash.actions.create.poll")
else
render :new
end
end
def edit
end
def update
if @poll.update(poll_params)
redirect_to [:admin, @poll], notice: t("flash.actions.update.poll")
else
render :edit
end
end
private
def poll_params
params.require(:poll).permit(:name)
end
end