Class: ArUserRole

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/ar_user_role.rb

Overview

Schema information

Table name: ar_user_role : User roles

id Integer id created_at Time created_at updated_at Time updated_at ar_role_id Object User role valid_from Date Role is valid from valid_to Date Role is valid to active Boolean Role is active created_by Integer created_by updated_by Integer Role last updated

ArUserRole documents are embedded in ArUser model and define user roles which belong to user.

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Determine of role is still active

Returns:

  • (Boolean)


49
50
51
52
# File 'app/models/ar_user_role.rb', line 49

def active?
  now = Time.current
  active && (valid_from.nil? || now > valid_from) && (valid_to.nil? || now < valid_to)
end