Skip to content

Instantly share code, notes, and snippets.

@adamaig
Created January 9, 2011 21:38
Show Gist options
  • Select an option

  • Save adamaig/772045 to your computer and use it in GitHub Desktop.

Select an option

Save adamaig/772045 to your computer and use it in GitHub Desktop.
class ItemCollection < ActiveRecord::Base
has_many :item_definitions,
:inverse_of => :item_collection, :conditions => {:type => "item"},
:dependent => :destroy
has_many :meters, :class_name => "ItemDefinition",
:inverse_of => :item_collection, :conditions => {:type => "meter"},
:dependent => :destroy
has_many :timeline_trackers, :class_name => "ItemDefinition",
:inverse_of => :item_collection, :conditions => {:type => "timeline_tracker"},
:dependent => :destroy
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment