Class: HrLite::HolidaysController

Inherits:
ApplicationController show all
Defined in:
app/controllers/hr_lite/holidays_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
# File 'app/controllers/hr_lite/holidays_controller.rb', line 3

def index
  year = params[:year].to_i
  @year = year.between?(2000, 2100) ? year : Date.current.year
  @holidays = Holiday.where(date: Date.new(@year, 1, 1)..Date.new(@year, 12, 31)).order(:date)
end