Permalink
Browse files

add validation in Comment Nodel

  • Loading branch information...
1 parent 0ea4d32 commit 0020e29e301a2f70f949027c47e5682e092b876d @sakomoko committed Feb 28, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 app/models/comment.rb
@@ -1,9 +1,13 @@
class Comment
include Mongoid::Document
+ include Mongoid::Timestamps
+
field :body, :type => String
belongs_to :user
embedded_in :commentable, polymorphic: true
attr_protected :user_id
+
+ validates_presence_of :body
end

0 comments on commit 0020e29

Please sign in to comment.