因此,我试图在正在使用的Rails应用程序中为模型设置审核。按照目前的情况,我尝试在更新3个不同的字段时对其进行审核,但只会保存上一次审核。
class Employee < ApplicationRecord
include Filterable
monetize :salary_cents, :as => "salary"
belongs_to :employee_status
has_many :leave_balances
has_many :leave_balance_histories
has_many :emergency_contacts
has_many :dependents
has_one :onboarding
has_many :employee_leave_policy_rels
has_many :leave_policy_types, through: :employee_leave_policy_rels
has_many :employee_trainings
has_many :employee_benefits
belongs_to :termination_type, optional: true
#validates :status, :presence => true
acts_as_birthday :birth_date
audited
我正在使用已审计的库进行审计。
这些是我用来获取审核意见的下拉列表
<div class="dropdown col-xs-12 col-md-4" id="salary-audit-comment">
<% reasons = AuditReason.order(:reason).pluck(:reason) %>
<%= f.label :audit_comment, '*Salary Audit Reason', class: "control-label", style: 'color: red;' %>
<%= f.select :audit_comment, reasons, {:include_blank => false, prompt: 'Select Reason'},
class: "form-control", id: "salary-audit-comment-select" %>
</div>
<div class="dropdown col-xs-12 col-md-4" id="title-audit-comment">
<% reasons = AuditReason.order(:reason).pluck(:reason) %>
<%= f.label :audit_comment, '*Title Audit Reason', class: "control-label", style: 'color: red;' %>
<%= f.select :audit_comment, reasons, {:include_blank => false, prompt: 'Select Reason'},
class: "form-control", id: "title-audit-comment-select" %>
</div>
<div class="dropdown col-xs-12 col-md-4" id="status-audit-comment">
<% reasons = AuditReason.order(:reason).pluck(:reason) %>
<%= f.label :audit_comment, '*Status Audit Reason', class: "control-label", style: 'color: red;' %>
<%= f.select :audit_comment, reasons, {:include_blank => false, prompt: 'Select Reason'},
class: "form-control", id: "status-audit-comment-select" %>
</div>
我希望能够在保存表单时保存3个单独的审核,或者将所有三个注释合并为一个audit_comment。
还有主意吗?