Sha256: 74b9c6bf7677c2dec4b4203432083f966b2cd9ac7365ad0c62c2a856942315a0
Contents?: true
Size: 1.37 KB
Versions: 47
Compression:
Stored size: 1.37 KB
Contents
require 'uuidtools' class Tag < ActiveRecord::Base acts_as_tree :dependent => :destroy, :order => "name" before_destroy :add_destroyed_tag attr_accessible :name def to_s name end def add_destroyed_tag # Proof for the tests that the destroy rather than the delete method was called: DestroyedTag.create(:name => name) end end class DestroyedTag < ActiveRecord::Base attr_accessible :name end class User < ActiveRecord::Base acts_as_tree :parent_column_name => "referrer_id", :name_column => 'email', :hierarchy_class_name => 'ReferralHierarchy', :hierarchy_table_name => 'referral_hierarchies' has_many :contracts def indirect_contracts Contract.where(:user_id => descendant_ids) end attr_accessible :email, :referrer def to_s email end end class Contract < ActiveRecord::Base belongs_to :user end class Label < ActiveRecord::Base attr_accessible :name # < - make sure order doesn't matter acts_as_tree :order => "sort_order", :parent_column_name => "mother_id", :dependent => :destroy def to_s "#{self.class}: #{name}" end end class EventLabel < Label end class DateLabel < Label end class DirectoryLabel < Label end class CuisineType < ActiveRecord::Base acts_as_tree end module Namespace class Type < ActiveRecord::Base acts_as_tree :dependent => :destroy attr_accessible :name end end
Version data entries
47 entries across 47 versions & 2 rubygems