diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-19 13:01:47 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-19 13:01:47 +0000 |
commit | 356f16006b44ee500db0fda0da055436ff41e37e (patch) | |
tree | afbff527c329a72c8ff41b65f05e24486248f897 /activerecord/test/fixtures | |
parent | eeae1eecb9d02c4a3d8cf8436503f594acd8b302 (diff) | |
download | rails-356f16006b44ee500db0fda0da055436ff41e37e.tar.gz rails-356f16006b44ee500db0fda0da055436ff41e37e.tar.bz2 rails-356f16006b44ee500db0fda0da055436ff41e37e.zip |
Added higher_item and lower_item as public methods for acts_as_list #342 [Tobias Luetke]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@221 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/fixtures')
-rwxr-xr-x | activerecord/test/fixtures/db_definitions/mysql.sql | 7 | ||||
-rw-r--r-- | activerecord/test/fixtures/db_definitions/postgresql.sql | 1 | ||||
-rw-r--r-- | activerecord/test/fixtures/db_definitions/sqlite.sql | 1 | ||||
-rw-r--r-- | activerecord/test/fixtures/db_definitions/sqlserver.sql | 1 | ||||
-rw-r--r-- | activerecord/test/fixtures/mixin.rb | 7 | ||||
-rw-r--r-- | activerecord/test/fixtures/mixins.yml | 30 |
6 files changed, 35 insertions, 12 deletions
diff --git a/activerecord/test/fixtures/db_definitions/mysql.sql b/activerecord/test/fixtures/db_definitions/mysql.sql index 137fbaa73e..7bd06e6243 100755 --- a/activerecord/test/fixtures/db_definitions/mysql.sql +++ b/activerecord/test/fixtures/db_definitions/mysql.sql @@ -102,10 +102,11 @@ CREATE TABLE `mixins` ( `id` int(11) NOT NULL auto_increment, `parent_id` int(11) default NULL, `pos` int(11) default NULL, - `lft` int(11) default NULL, - `rgt` int(11) default NULL, - `root_id` int(11) default NULL, `created_at` datetime default NULL, `updated_at` datetime default NULL, + `lft` int(11) default NULL, + `rgt` int(11) default NULL, + `root_id` int(11) default NULL, + `type` varchar(40) default NULL, PRIMARY KEY (`id`) ); diff --git a/activerecord/test/fixtures/db_definitions/postgresql.sql b/activerecord/test/fixtures/db_definitions/postgresql.sql index 4ca0e9ddc3..305852ba7f 100644 --- a/activerecord/test/fixtures/db_definitions/postgresql.sql +++ b/activerecord/test/fixtures/db_definitions/postgresql.sql @@ -118,6 +118,7 @@ CREATE TABLE colnametests ( CREATE TABLE mixins ( id serial, parent_id integer, + type character varying, pos integer, lft integer, rgt integer, diff --git a/activerecord/test/fixtures/db_definitions/sqlite.sql b/activerecord/test/fixtures/db_definitions/sqlite.sql index 832a1a7d31..1e9aed1e1b 100644 --- a/activerecord/test/fixtures/db_definitions/sqlite.sql +++ b/activerecord/test/fixtures/db_definitions/sqlite.sql @@ -90,6 +90,7 @@ CREATE TABLE 'colnametests' ( CREATE TABLE 'mixins' ( 'id' INTEGER NOT NULL PRIMARY KEY, 'parent_id' INTEGER DEFAULT NULL, + 'type' VARCHAR(40) DEFAULT NULL, 'pos' INTEGER DEFAULT NULL, 'lft' INTEGER DEFAULT NULL, 'rgt' INTEGER DEFAULT NULL, diff --git a/activerecord/test/fixtures/db_definitions/sqlserver.sql b/activerecord/test/fixtures/db_definitions/sqlserver.sql index 0cc8899945..4152ef59cb 100644 --- a/activerecord/test/fixtures/db_definitions/sqlserver.sql +++ b/activerecord/test/fixtures/db_definitions/sqlserver.sql @@ -99,6 +99,7 @@ CREATE TABLE colnametests ( CREATE TABLE mixins ( id int NOT NULL IDENTITY(1, 1), parent_id int default NULL, + type varchar(40) default NULL, pos int default NULL, lft int default NULL, rgt int default NULL, diff --git a/activerecord/test/fixtures/mixin.rb b/activerecord/test/fixtures/mixin.rb index 1b6099901f..b14b0f3132 100644 --- a/activerecord/test/fixtures/mixin.rb +++ b/activerecord/test/fixtures/mixin.rb @@ -1,9 +1,12 @@ class Mixin < ActiveRecord::Base - acts_as_tree :foreign_key => "parent_id", :order => "id" end -class ListMixin < ActiveRecord::Base +class TreeMixin < Mixin + acts_as_tree :foreign_key => "parent_id", :order => "id" +end + +class ListMixin < Mixin acts_as_list :column => "pos", :scope => :parent def self.table_name() "mixins" end diff --git a/activerecord/test/fixtures/mixins.yml b/activerecord/test/fixtures/mixins.yml index c74b1da51b..e326f6675e 100644 --- a/activerecord/test/fixtures/mixins.yml +++ b/activerecord/test/fixtures/mixins.yml @@ -1,14 +1,30 @@ -first: +# tree mixins +tree_1: id: 1 - pos: 1 + type: TreeMixin parent_id: 0 -second: +tree_2: id: 2 - pos: 1 + type: TreeMixin parent_id: 1 -third: +tree_3: id: 3 - pos: 2 - parent_id: 1
\ No newline at end of file + type: TreeMixin + parent_id: 2 + +tree_4: + id: 4 + type: TreeMixin + parent_id: 1 + +# List mixins + +<% (1..4).each do |counter| %> +list_<%= counter %>: + id: <%= counter+6 %> + pos: <%= counter %> + type: ListMixin + parent_id: 5 +<% end %>
\ No newline at end of file |