From 11f4d28344e2b10de08a3dafdf1b0c5de34325c7 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 11 Sep 2007 03:09:37 +0000 Subject: Moved acts_as_nested_set into a plugin of the same name on the official Rails svn (closed #9516) [josh] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7453 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/fixtures/mixin.rb | 28 ++++++++++++++++++++++++++++ activerecord/test/fixtures/mixins.yml | 18 ------------------ 2 files changed, 28 insertions(+), 18 deletions(-) (limited to 'activerecord/test/fixtures') diff --git a/activerecord/test/fixtures/mixin.rb b/activerecord/test/fixtures/mixin.rb index 5e40c397c0..358dde1ae1 100644 --- a/activerecord/test/fixtures/mixin.rb +++ b/activerecord/test/fixtures/mixin.rb @@ -16,6 +16,34 @@ class RecursivelyCascadedTreeMixin < Mixin end +class NestedSet < Mixin + acts_as_nested_set :scope => "root_id IS NULL" + + 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 + + def self.table_name() "mixins" end +end + +class NestedSetSuperclass < Mixin + acts_as_nested_set :scope => :root + + def self.table_name() "mixins" end +end + +class NestedSetSubclass < NestedSetSuperclass + +end + class NestedSet < Mixin acts_as_nested_set :scope => "root_id IS NULL" diff --git a/activerecord/test/fixtures/mixins.yml b/activerecord/test/fixtures/mixins.yml index 6c66eb559c..c79ff41070 100644 --- a/activerecord/test/fixtures/mixins.yml +++ b/activerecord/test/fixtures/mixins.yml @@ -68,24 +68,6 @@ set_<%= counter %>: type: NestedSet <% end %> -# Nested set with STI -<% -[ [3100, 0, 1, 10, "NestedSetSuperclass"], - [3101, 3100, 2, 5, "NestedSetSubclass"], - [3102, 3101, 3, 4, "NestedSetSuperclass"], - [3103, 3100, 6, 9, "NestedSetSuperclass"], - [3104, 3103, 7, 8, "NestedSetSubclass"] -].each do |sti| %> -sti_set_<%= sti[0] %>: - id: <%= sti[0] %> - parent_id: <%= sti[1] %> - lft: <%= sti[2] %> - rgt: <%= sti[3] %> - type: <%= sti[4] %> - root_id: 3100 - -<% end %> - # Big old set <% [[4001, 0, 1, 20], -- cgit v1.2.3