Class: TimesheetsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/timesheets_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



2
3
4
5
6
7
# File 'app/controllers/timesheets_controller.rb', line 2

def index
  @employee = Employee.find(params[:employee_id])
  WorkDay.create_or_update_upto(@employee, Date.today.end_of_month)
  range = Date.today.beginning_of_month..Date.today.end_of_month
  @work_days = @employee.work_days.where(:date => range)
end

#startObject



9
10
11
12
13
14
# File 'app/controllers/timesheets_controller.rb', line 9

def start
  @employee = Employee.find(params[:employee_id])
  @employee.work_days.create(:date => params[:timesheet][:duration_from])

  redirect_to @employee
end