added model Comment.

comments can now be added on news.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@81 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2006-12-10 18:35:48 +00:00
parent 28c6aa4e6d
commit 55ed70529a
17 changed files with 153 additions and 5 deletions
+6
View File
@@ -0,0 +1,6 @@
class Comment < ActiveRecord::Base
belongs_to :commented, :polymorphic => true, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :commented, :author, :comment
end
+1
View File
@@ -18,6 +18,7 @@
class News < ActiveRecord::Base
belongs_to :project
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :comments, :as => :commented, :dependent => true, :order => "created_on"
validates_presence_of :title, :description