aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-11-29 10:09:42 -0800
committerJon Leighton <j@jonathanleighton.com>2011-11-29 10:09:42 -0800
commit2169603385a447256d713873be6b2fbb6e2591fa (patch)
tree8a56b9264808c0e7b0cba8fc895e364a75c3bc05 /activerecord/test/models
parentd534c8fbe26dbc1101d80ad3af4cf166d0e3cda8 (diff)
parentc347b3c06c2867badce5e22ecfbed3e972960c29 (diff)
downloadrails-2169603385a447256d713873be6b2fbb6e2591fa.tar.gz
rails-2169603385a447256d713873be6b2fbb6e2591fa.tar.bz2
rails-2169603385a447256d713873be6b2fbb6e2591fa.zip
Merge pull request #3636 from joshsusser/master
association methods are now generated in modules
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/author.rb1
-rw-r--r--activerecord/test/models/post.rb4
2 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index 23db5650d4..bfadfd9d75 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -128,7 +128,6 @@ class Author < ActiveRecord::Base
belongs_to :author_address, :dependent => :destroy
belongs_to :author_address_extra, :dependent => :delete, :class_name => "AuthorAddress"
- has_many :post_categories, :through => :posts, :source => :categories
has_many :category_post_comments, :through => :categories, :source => :post_comments
has_many :misc_posts, :class_name => 'Post',
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 198a963cbc..137cee3752 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -24,6 +24,10 @@ class Post < ActiveRecord::Base
belongs_to :author_with_posts, :class_name => "Author", :foreign_key => :author_id, :include => :posts
belongs_to :author_with_address, :class_name => "Author", :foreign_key => :author_id, :include => :author_address
+ def first_comment
+ super.body
+ end
+ has_one :first_comment, :class_name => 'Comment', :order => 'id ASC'
has_one :last_comment, :class_name => 'Comment', :order => 'id desc'
scope :with_special_comments, :joins => :comments, :conditions => {:comments => {:type => 'SpecialComment'} }