Class: AdjustableSchema::Relationship::Role

Inherits:
ApplicationRecord show all
Defined in:
app/models/adjustable_schema/relationship/role.rb

Class Method Summary collapse

Class Method Details

.[](*names, **scopes) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'app/models/adjustable_schema/relationship/role.rb', line 20

def [] *names, **scopes
	if scopes.any?
		with_relationships { self[**scopes] }
				.distinct
	else
		all
	end
			.scoping { names.any? ? super(*names) : all }
end

.with_relationshipsObject



14
15
16
17
# File 'app/models/adjustable_schema/relationship/role.rb', line 14

def self.with_relationships(&)
	joins(:relationships)
			.merge Relationship.instance_eval(&)
end