Sha256: 7f4ab197fd3f3c36be10e63ff81662eb80abdfb2f1b0bf18d4ccfab9886db0e0
Contents?: true
Size: 508 Bytes
Versions: 8
Compression:
Stored size: 508 Bytes
Contents
class User < ActiveRecord::Base authenticates_with_sorcery! validates_presence_of :email has_many :group_users has_many :groups, through: :group_users has_many :role_group_users, through: :group_users accepts_nested_attributes_for :group_users, reject_if: :all_blank, allow_destroy: :true accepts_nested_attributes_for :role_group_users, reject_if: :all_blank, allow_destroy: :true scope :all_belonging_to, -> (user) { includes(group_users: :group).where(groups: { id: user.groups }) } end
Version data entries
8 entries across 4 versions & 1 rubygems