Skip to content

Instantly share code, notes, and snippets.

@threetee
Created January 12, 2010 08:38
Show Gist options
  • Save threetee/275023 to your computer and use it in GitHub Desktop.
Save threetee/275023 to your computer and use it in GitHub Desktop.
class Asset < ActiveRecord::Base
has_many :service_assignments
has_many :services, :through => :service_assignments
has_many :functions, :through => :services
has_many :clusters, :through => :services
end
class ServiceAssignment < ActiveRecord::Base
belongs_to :asset
belongs_to :service
end
class Service < ActiveRecord::Base
belongs_to :cluster
belongs_to :function
end
class Cluster < ActiveRecord::Base
has_many :services
has_many :assets, :through => :services
end
class Function < ActiveRecord::Base
has_many :services
has_many :assets, :through => :services
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment