Skip to content

Commit

Permalink
Add validations on Post
Browse files Browse the repository at this point in the history
  • Loading branch information
jm committed Feb 5, 2010
1 parent 930e886 commit 178bb06
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/models/post.rb
@@ -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
Expand Down

0 comments on commit 178bb06

Please sign in to comment.