Sha256: d683782004cc740eae6fb0bcb51b7c51d356a4809dda42ff9218617bd6f5e057
Contents?: true
Size: 697 Bytes
Versions: 6
Compression:
Stored size: 697 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 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
6 entries across 6 versions & 1 rubygems