2004-12-14 19:46:26 -05:00
|
|
|
class Mixin < ActiveRecord::Base
|
2004-12-15 21:49:18 -05:00
|
|
|
|
2004-12-14 19:46:26 -05:00
|
|
|
end
|
|
|
|
|
2004-12-19 08:01:47 -05:00
|
|
|
class TreeMixin < Mixin
|
|
|
|
acts_as_tree :foreign_key => "parent_id", :order => "id"
|
|
|
|
end
|
|
|
|
|
2005-11-09 07:50:35 -05:00
|
|
|
class TreeMixinWithoutOrder < Mixin
|
|
|
|
acts_as_tree :foreign_key => "parent_id"
|
|
|
|
end
|
|
|
|
|
2004-12-19 08:01:47 -05:00
|
|
|
class ListMixin < Mixin
|
2004-12-16 08:37:06 -05:00
|
|
|
acts_as_list :column => "pos", :scope => :parent
|
2004-12-15 21:49:18 -05:00
|
|
|
|
2004-12-16 10:21:16 -05:00
|
|
|
def self.table_name() "mixins" end
|
2004-12-16 08:42:21 -05:00
|
|
|
end
|
|
|
|
|
2005-11-10 01:19:50 -05:00
|
|
|
class ListMixinSub1 < ListMixin
|
|
|
|
end
|
|
|
|
|
|
|
|
class ListMixinSub2 < ListMixin
|
|
|
|
end
|
|
|
|
|
2004-12-16 08:42:21 -05:00
|
|
|
|
|
|
|
class ListWithStringScopeMixin < ActiveRecord::Base
|
|
|
|
acts_as_list :column => "pos", :scope => 'parent_id = #{parent_id}'
|
|
|
|
|
2005-04-17 05:52:12 -04:00
|
|
|
def self.table_name() "mixins" end
|
|
|
|
end
|
|
|
|
|
|
|
|
class NestedSet < Mixin
|
2006-03-01 20:15:41 -05:00
|
|
|
acts_as_nested_set :scope => "root_id IS NULL"
|
2005-04-17 05:52:12 -04:00
|
|
|
|
|
|
|
def self.table_name() "mixins" end
|
|
|
|
end
|
|
|
|
|
|
|
|
class NestedSetWithStringScope < Mixin
|
|
|
|
acts_as_nested_set :scope => 'root_id = #{root_id}'
|
|
|
|
|
|
|
|
def self.table_name() "mixins" end
|
|
|
|
end
|
|
|
|
|
|
|
|
class NestedSetWithSymbolScope < Mixin
|
|
|
|
acts_as_nested_set :scope => :root
|
|
|
|
|
2004-12-16 10:21:16 -05:00
|
|
|
def self.table_name() "mixins" end
|
2005-11-09 07:50:35 -05:00
|
|
|
end
|