aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r--activerecord/test/fixtures/developer.rb8
-rw-r--r--activerecord/test/fixtures/post.rb16
2 files changed, 20 insertions, 4 deletions
diff --git a/activerecord/test/fixtures/developer.rb b/activerecord/test/fixtures/developer.rb
index 1a4f0648bb..336b48f087 100644
--- a/activerecord/test/fixtures/developer.rb
+++ b/activerecord/test/fixtures/developer.rb
@@ -1,5 +1,11 @@
class Developer < ActiveRecord::Base
- has_and_belongs_to_many :projects
+ has_and_belongs_to_many :projects, :extend => Module.new {
+ def find_most_recent
+ find(:first, :order => "id DESC")
+ end
+ }
+
+
has_and_belongs_to_many :special_projects, :join_table => 'developers_projects', :association_foreign_key => 'project_id'
validates_inclusion_of :salary, :in => 50000..200000
diff --git a/activerecord/test/fixtures/post.rb b/activerecord/test/fixtures/post.rb
index f5adac41dc..6163ec90f8 100644
--- a/activerecord/test/fixtures/post.rb
+++ b/activerecord/test/fixtures/post.rb
@@ -1,7 +1,17 @@
class Post < ActiveRecord::Base
- belongs_to :author
- has_many :comments, :order => "body"
- has_one :very_special_comment, :class_name => "VerySpecialComment"
+ belongs_to :author, :extend => Module.new {
+ def greeting
+ "hello"
+ end
+ }
+
+ has_many :comments, :order => "body", :extend => Module.new {
+ def find_most_recent
+ find(:first, :order => "id DESC")
+ end
+ }
+
+
has_many :special_comments, :class_name => "SpecialComment"
has_and_belongs_to_many :categories
has_and_belongs_to_many :special_categories, :join_table => "categories_posts"