app/models/user.rb
def is_active?(dept)
    if DepartmentsUser.where(user_id: self, department_id: dept, active: true).first
      true
    else
      false
    end
  end
# check to make sure the user is "active" in the given dept
check to make sure the user is "active" in the given dept
check to make sure the user is " active " in the given dept
def is_active?(dept)
    if DepartmentsUser.where(user_id: self, department_id: dept, active: true).first
      true
    else
      false
    end
  end
def is_active? ( dept ) if DepartmentsUser . where ( user_id : self , department_id : dept , active : true ) . first true else false end end
check to make sure the user is "active" in the given dept
check to make sure the user is " active " in the given dept
dept