Class: EmployeeRole
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- EmployeeRole
- Defined in:
- app/models/employee_role.rb
Class Method Summary collapse
- .insert_update_procedure(employee_id:, description:, hourly_rate:, health_safety_reference_code:, apply_overtime:, work_hours_per_week:, user:, employee_role_id: 0) ⇒ Object
- .where_procedure(employee_id:, company_id:, employee_role_id: 0) ⇒ Object
Methods inherited from ApplicationRecord
define_decrypted_attribute, define_decrypted_attributes, #errors_in_bullet_points, primary_connection, special_connection
Class Method Details
.insert_update_procedure(employee_id:, description:, hourly_rate:, health_safety_reference_code:, apply_overtime:, work_hours_per_week:, user:, employee_role_id: 0) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/models/employee_role.rb', line 48 def insert_update_procedure( employee_id:, description:, hourly_rate:, health_safety_reference_code:, apply_overtime:, work_hours_per_week:, user:, employee_role_id: 0 ) res = ActiveRecord::Base.execute_procedure( :pr_insert_update_employee_role, employee_role_id || 0, employee_id, description, hourly_rate, health_safety_reference_code, apply_overtime, work_hours_per_week, user ) res[0]['employee_role_id'] end |
.where_procedure(employee_id:, company_id:, employee_role_id: 0) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/models/employee_role.rb', line 24 def where_procedure(employee_id:, company_id:, employee_role_id: 0) data = ActiveRecord::Base.execute_procedure( :pr_get_employee_role, employee_role_id, employee_id ) data = data.each do |row| row['health_and_safety_reference_description'] = CompanyParameter.find_by( reference_code: row['health_safety_reference_code'], company_id: company_id )&.reference_description end = { total: data.length } { data: data, metadata: } end |