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