Files
grecia/app/controllers/officing/booth_controller.rb
Javi Martín f7f9fc15a5 Move todays_booths_for_officer to the model
This way we can easily add a test which will fail if by accident we
change the method to use `Date.today`. Until now using `Date.today`
would only fail if we ran specs in a time zone with a different date.
2019-03-28 15:49:17 +01:00

25 lines
465 B
Ruby

class Officing::BoothController < Officing::BaseController
before_action :load_officer_assignment
before_action :verify_officer_assignment
def new
@booths = current_user.poll_officer.todays_booths
end
def create
set_booth(Poll::Booth.find(booth_params[:id]))
redirect_to officing_root_path
end
private
def booth_params
params.require(:booth).permit(:id)
end
def set_booth(booth)
session[:booth_id] = booth.id
end
end