Class: HrLite::PoliciesController

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

Overview

What people are held to, and the button that says they have read it.

Instance Method Summary collapse

Instance Method Details

#acknowledgeObject



16
17
18
19
20
# File 'app/controllers/hr_lite/policies_controller.rb', line 16

def acknowledge
  policy = Policy.published.find(params[:id])
  policy.acknowledge!(hr_current_user)
  redirect_to policies_path, notice: "Thank you — recorded against #{policy.title} v#{policy.version}."
end

#indexObject



6
7
8
9
10
# File 'app/controllers/hr_lite/policies_controller.rb', line 6

def index
  @policies = Policy.current.sort_by(&:title)
  @acknowledged = PolicyAcknowledgement.where(user_id: hr_current_user.id)
                                       .pluck(:policy_id).to_set
end

#showObject



12
13
14
# File 'app/controllers/hr_lite/policies_controller.rb', line 12

def show
  @policy = Policy.published.find(params[:id])
end