Sha256: 85f4fc22fdb7c12e9017fb81a1c5d35daa3a6aa01a72e5b87a11882fd486fd63
Contents?: true
Size: 703 Bytes
Versions: 8
Compression:
Stored size: 703 Bytes
Contents
module Adeia module Helpers module UserHelper extend ActiveSupport::Concern module ClassMethods def human_name model_name.i18n_key end end included do extend ClassMethods has_many :permissions, class_name: "Adeia::Permission" end def add_to_group(name) group = Group.find_by_name(name) Adeia::GroupUser.create(group: group, user: self) end def permissions @permissions ||= Adeia::Permission.where(owner: groups << self) end def groups @groups ||= Adeia::Group.joins(:group_users).where(adeia_group_users: { user_id: self.id }) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems