Skip to content

Commit

Permalink
Merge pull request #19071 from martinpovolny/add_details_for_tenants
Browse files Browse the repository at this point in the history
Add association methods for tenants (service templates, providers, au…
  • Loading branch information
agrare authored Aug 7, 2019
2 parents 737c4aa + b723f4a commit e7c5229
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/models/tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ def regional_tenants
self.class.regional_tenants(self)
end

def nested_service_templates
ServiceTemplate.with_tenant(id)
end

def nested_providers
ExtManagementSystem.with_tenant(id)
end

def nested_ae_namespaces
MiqAeDomain.with_tenant(id)
end

def self.regional_tenants(tenant)
where(arel_table.grouping(Arel::Nodes::NamedFunction.new("LOWER", [arel_attribute(:name)]).eq(tenant.name.downcase)))
end
Expand Down

0 comments on commit e7c5229

Please sign in to comment.