aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/comment.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-07-12 00:04:01 +0100
committerJon Leighton <j@jonathanleighton.com>2011-07-12 00:14:45 +0100
commit1712d90050bd4b32a9ee93548b5eef05a69491f7 (patch)
treecf76c0d1847f96d8f71c30f10c741d46dbe6f4b1 /activerecord/test/models/comment.rb
parent5c8be9eb864886d7ba9abba0d59786614cca2a5a (diff)
downloadrails-1712d90050bd4b32a9ee93548b5eef05a69491f7.tar.gz
rails-1712d90050bd4b32a9ee93548b5eef05a69491f7.tar.bz2
rails-1712d90050bd4b32a9ee93548b5eef05a69491f7.zip
Fix exception if old and new targets are both nil. Fixes #1471.
Diffstat (limited to 'activerecord/test/models/comment.rb')
-rw-r--r--activerecord/test/models/comment.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/models/comment.rb b/activerecord/test/models/comment.rb
index 43650c0427..88b139d931 100644
--- a/activerecord/test/models/comment.rb
+++ b/activerecord/test/models/comment.rb
@@ -7,10 +7,13 @@ class Comment < ActiveRecord::Base
:joins => :post,
:conditions => { "posts.author_id" => 1 }
scope :created
-
+
belongs_to :post, :counter_cache => true
has_many :ratings
+ has_many :children, :class_name => 'Comment', :foreign_key => :parent_id
+ belongs_to :parent, :class_name => 'Comment', :counter_cache => :children_count
+
def self.what_are_you
'a comment...'
end