metamaps--metamaps/app/models/item.rb
2012-09-22 22:39:12 -04:00

19 lines
509 B
Ruby

class Item < ActiveRecord::Base
belongs_to :user
has_many :itemitem_c, :foreign_key => 'parent_item_id', :class_name => 'Itemitem'
has_many :itemitem_p, :foreign_key => 'item_id', :class_name => 'Itemitem'
has_many :groupitems
has_many :personitems
has_many :groups, :through => :groupitems
has_many :people, :through => :personitems
belongs_to :item_category
has_many :child_items, :through => :itemitem_c, :source => :item
has_many :parent_items, :through => :itemitem_p, :source => :parent_item
end