Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adds dependent destroy on user/post/comment models

  • Loading branch information...
commit ce826326cbebb9ee2fae337b8d38bd2f81c82123 1 parent eca0cf9
Javier Fonseca V authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  app/models/post.rb
  2. +1 −1  app/models/user.rb
View
2  app/models/post.rb
@@ -1,6 +1,6 @@
class Post < ActiveRecord::Base
belongs_to :user
- has_many :comments
+ has_many :comments, :dependent => :destroy
validates_presence_of :title, :content, :user_id
attr_accessible :title, :content
View
2  app/models/user.rb
@@ -1,5 +1,5 @@
class User < ActiveRecord::Base
- has_many :posts
+ has_many :posts, :dependent => :destroy
validates_presence_of :full_name

0 comments on commit ce82632

Please sign in to comment.
Something went wrong with that request. Please try again.