Permalink
Browse files

Add validations on Post

  • Loading branch information...
jm committed Feb 5, 2010
1 parent 930e886 commit 178bb06839bb44978f42c922c9348bfe783da8b1
Showing with 3 additions and 0 deletions.
  1. +3 −0 app/models/post.rb
View
@@ -1,6 +1,9 @@
class Post < ActiveRecord::Base
before_save :render_body
validates :title, :presence => true
validates :body, :presence => true
def render_body
self.rendered_body = RDiscount.new(self.body).to_html
end

0 comments on commit 178bb06

Please sign in to comment.