Project

General

Profile

« Previous | Next » 

Revision 12f8ea80

Added by Dominic Cleal over 6 years ago

Fixes #21024 - Reorder AR associations in order of use

View differences:

app/models/provisioning_template.rb
validates :template_kind_id, :presence => true, :unless => Proc.new {|t| t.snippet }
before_destroy EnsureNotUsedBy.new(:hostgroups, :environments, :os_default_templates)
has_many :template_combinations, :dependent => :destroy
has_many :hostgroups, :through => :template_combinations
has_many :environments, :through => :template_combinations
has_many :template_combinations, :dependent => :destroy
belongs_to :template_kind
accepts_nested_attributes_for :template_combinations, :allow_destroy => true,
:reject_if => ->(tc) { tc[:environment_id].blank? && tc[:hostgroup_id].blank? }
app/models/user.rb
has_many :usergroup_member, :dependent => :destroy, :as => :member
has_many :user_roles, :dependent => :destroy, :as => :owner
has_many :cached_user_roles, :dependent => :destroy
has_many :cached_usergroup_members
has_many :cached_usergroups, :through => :cached_usergroup_members, :source => :usergroup
has_many :cached_roles, -> { distinct }, :through => :cached_user_roles, :source => :role
has_many :usergroups, :through => :usergroup_member, :dependent => :destroy
has_many :roles, :through => :user_roles, :dependent => :destroy
has_many :filters, :through => :cached_roles
has_many :permissions, :through => :filters
has_many :cached_usergroup_members
has_many :widgets, :dependent => :destroy
has_many :ssh_keys, :dependent => :destroy

Also available in: Unified diff