diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-03 10:52:05 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-03 10:52:05 +0000 |
commit | abc895b82829657d34f4902ce0cf04f0682bab63 (patch) | |
tree | df164ff14acac26c22a3205331a5ae4898f05d03 /activerecord/test/fixtures | |
parent | 17e5035bc566815b8aa8c192fec97a781f726938 (diff) | |
download | rails-abc895b82829657d34f4902ce0cf04f0682bab63.tar.gz rails-abc895b82829657d34f4902ce0cf04f0682bab63.tar.bz2 rails-abc895b82829657d34f4902ce0cf04f0682bab63.zip |
Added new Base.find API and deprecated find_all, find_first. Added preliminary support for eager loading of associations
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1077 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r-- | activerecord/test/fixtures/author.rb | 3 | ||||
-rw-r--r-- | activerecord/test/fixtures/authors.yml | 9 | ||||
-rw-r--r-- | activerecord/test/fixtures/comment.rb | 3 | ||||
-rw-r--r-- | activerecord/test/fixtures/comments.yml | 14 | ||||
-rw-r--r-- | activerecord/test/fixtures/courses.yml | 8 | ||||
-rw-r--r-- | activerecord/test/fixtures/db_definitions/sqlite.drop.sql | 4 | ||||
-rw-r--r-- | activerecord/test/fixtures/db_definitions/sqlite.sql | 18 | ||||
-rw-r--r-- | activerecord/test/fixtures/post.rb | 4 | ||||
-rw-r--r-- | activerecord/test/fixtures/posts.yml | 9 |
9 files changed, 67 insertions, 5 deletions
diff --git a/activerecord/test/fixtures/author.rb b/activerecord/test/fixtures/author.rb new file mode 100644 index 0000000000..8d12190086 --- /dev/null +++ b/activerecord/test/fixtures/author.rb @@ -0,0 +1,3 @@ +class Author < ActiveRecord::Base + belongs_to :post +end
\ No newline at end of file diff --git a/activerecord/test/fixtures/authors.yml b/activerecord/test/fixtures/authors.yml new file mode 100644 index 0000000000..718c317c37 --- /dev/null +++ b/activerecord/test/fixtures/authors.yml @@ -0,0 +1,9 @@ +david: + id: 1 + post_id: 1 + name: David + +mary: + id: 2 + post_id: 2 + name: Mary diff --git a/activerecord/test/fixtures/comment.rb b/activerecord/test/fixtures/comment.rb new file mode 100644 index 0000000000..662b7db66b --- /dev/null +++ b/activerecord/test/fixtures/comment.rb @@ -0,0 +1,3 @@ +class Comment < ActiveRecord::Base + belongs_to :post +end
\ No newline at end of file diff --git a/activerecord/test/fixtures/comments.yml b/activerecord/test/fixtures/comments.yml new file mode 100644 index 0000000000..f970806b0b --- /dev/null +++ b/activerecord/test/fixtures/comments.yml @@ -0,0 +1,14 @@ +greetings: + id: 1 + post_id: 1 + body: Thank you for the welcome + +more_greetings: + id: 2 + post_id: 1 + body: Thank you again for the welcome + +does_it_hurt: + id: 3 + post_id: 2 + body: Don't think too hard
\ No newline at end of file diff --git a/activerecord/test/fixtures/courses.yml b/activerecord/test/fixtures/courses.yml index d4c0e3cfb9..5ee1916003 100644 --- a/activerecord/test/fixtures/courses.yml +++ b/activerecord/test/fixtures/courses.yml @@ -1,7 +1,7 @@ -java: - id: 2 - name: Java Development - ruby: id: 1 name: Ruby Development + +java: + id: 2 + name: Java Development diff --git a/activerecord/test/fixtures/db_definitions/sqlite.drop.sql b/activerecord/test/fixtures/db_definitions/sqlite.drop.sql index 1f611c8d5a..3fd60de17b 100644 --- a/activerecord/test/fixtures/db_definitions/sqlite.drop.sql +++ b/activerecord/test/fixtures/db_definitions/sqlite.drop.sql @@ -15,4 +15,6 @@ DROP TABLE mixins; DROP TABLE people; DROP TABLE binaries; DROP TABLE computers; - +DROP TABLE posts; +DROP TABLE comments; +DROP TABLE authors; diff --git a/activerecord/test/fixtures/db_definitions/sqlite.sql b/activerecord/test/fixtures/db_definitions/sqlite.sql index d57c3889e0..a6f2efcbfe 100644 --- a/activerecord/test/fixtures/db_definitions/sqlite.sql +++ b/activerecord/test/fixtures/db_definitions/sqlite.sql @@ -116,3 +116,21 @@ CREATE TABLE 'computers' ( 'developer' INTEGER NOT NULL ); +CREATE TABLE 'posts' ( + 'id' INTEGER NOT NULL PRIMARY KEY, + 'title' VARCHAR(255) NOT NULL, + 'body' TEXT NOT NULL +); + +CREATE TABLE 'comments' ( + 'id' INTEGER NOT NULL PRIMARY KEY, + 'post_id' INTEGER NOT NULL, + 'body' TEXT NOT NULL +); + +CREATE TABLE 'authors' ( + 'id' INTEGER NOT NULL PRIMARY KEY, + 'post_id' INTEGER NOT NULL, + 'name' VARCHAR(255) NOT NULL +); + diff --git a/activerecord/test/fixtures/post.rb b/activerecord/test/fixtures/post.rb new file mode 100644 index 0000000000..1fd78b8343 --- /dev/null +++ b/activerecord/test/fixtures/post.rb @@ -0,0 +1,4 @@ +class Post < ActiveRecord::Base + has_many :comments + has_one :author +end
\ No newline at end of file diff --git a/activerecord/test/fixtures/posts.yml b/activerecord/test/fixtures/posts.yml new file mode 100644 index 0000000000..21a110ef91 --- /dev/null +++ b/activerecord/test/fixtures/posts.yml @@ -0,0 +1,9 @@ +welcome: + id: 1 + title: Welcome to the weblog + body: Such a lovely day + +thinking: + id: 2 + title: So I was thinking + body: Like I hopefully always am |