aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures/post.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-11-03 09:06:42 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-11-03 09:06:42 +0000
commit8c512a1caffa11d1522cef5d2a35e2888c608581 (patch)
tree4fc18e0b02824638eb87d815231f470b9523231a /activerecord/test/fixtures/post.rb
parentf109bfb765fd54ef8bb94751c671a097089d7f53 (diff)
downloadrails-8c512a1caffa11d1522cef5d2a35e2888c608581.tar.gz
rails-8c512a1caffa11d1522cef5d2a35e2888c608581.tar.bz2
rails-8c512a1caffa11d1522cef5d2a35e2888c608581.zip
Added extension capabilities to has_many and has_and_belongs_to_many proxies [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2861 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/fixtures/post.rb')
-rw-r--r--activerecord/test/fixtures/post.rb16
1 files changed, 13 insertions, 3 deletions
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"