Sha256: 9972d6348e64fea18b4b89eb1bdac343f4e53fab227479515d51f4ce77063532
Contents?: true
Size: 825 Bytes
Versions: 6
Compression:
Stored size: 825 Bytes
Contents
module Ecm::Rbac class UserRole < ActiveRecord::Base # associations belongs_to :user, class_name: Ecm::Rbac::Configuration.user_class, foreign_key: 'user_id', inverse_of: :user_roles # belongs_to :enabled_user, foreign_key: 'user_id', class_name: 'User' belongs_to :role, inverse_of: :user_roles belongs_to :enabled_role, -> { enabled }, foreign_key: 'role_id', class_name: 'Ecm::Rbac::Role' has_many :enabled_role_permissions, through: :enabled_role, source: :user_roles, class_name: 'Ecm::Rbac::RolePermission' has_many :enabled_permissions, through: :enabled_role_permissions, class_name: 'Ecm::Rbac::Permission', source: :permission # validations validates :user, presence: true validates :user_id, uniqueness: { scope: :role_id } validates :role, presence: true end end
Version data entries
6 entries across 6 versions & 1 rubygems