Skip to content

Commit

Permalink
Add dependent destroy for post
Browse files Browse the repository at this point in the history
  • Loading branch information
yannr77 committed Jan 27, 2012
1 parent 49da5ed commit 13ccafb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/post.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class Post < ActiveRecord::Base
has_many :comments
has_many :comments, :dependent => :destroy

validates :name, :presence => true
validates :title, :presence => true, :length => { :minimum => 5 }
end

0 comments on commit 13ccafb

Please sign in to comment.