Sha256: 9663791da8db420fb259881866188f31028d1cfde04d51c4bae68c5dff14c280
Contents?: true
Size: 414 Bytes
Versions: 55
Compression:
Stored size: 414 Bytes
Contents
# The assignment of a Role to a User. class UserRole < ActiveRecord::Base ROLES = [ "Roles::Clinician", "Roles::Researcher", "Roles::ContentAuthor" ] belongs_to :user validates :user, :role_class_name, presence: true validates :role_class_name, inclusion: { in: ROLES } validates :role_class_name, uniqueness: { scope: :user_id } def role role_class_name.constantize.new end end
Version data entries
55 entries across 55 versions & 1 rubygems