嗨我有2张桌子员工&用户表,如果我使用员工表 在用户中也应该停用该员工,但是 当我犯这个错误时,任何人都可以告诉我我 错。
employee_controller.rb
def change_status
if params[:employee][:status] == "Abscond"
params[:employee][:last_working_date] = params[:emp_last_date]
elsif params[:employee][:status] == "Resigned" || params[:employee][:status] == "Internal Resignation"
params[:employee][:resignation_date] = params[:emp_last_date]
end
params[:employee].delete(:entity_id) if params[:employee][:entity_id].blank?
params[:employee].delete(:activate_reason) if params[:employee][:activate_reason].blank?
if @user.present?
@user.lock_access!
end
@employee.update_attributes(employee_params.merge!("updated_by" => current_user.id))
respond_with(@employee)
end
User_controller.rb
def change_status
if @user.access_locked?
@user.unlock_access!
else
@user.lock_access!
end
respond_with(@user)
end
if the employee get deactive means Abscond||resigned||internal designation means User should be get inactive, but using this only USer is getting in active not an employee...
Im trying to change the status from employee