Skip to content

Instantly share code, notes, and snippets.

@johnnaegle
Created March 15, 2014 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnnaegle/9561431 to your computer and use it in GitHub Desktop.
Save johnnaegle/9561431 to your computer and use it in GitHub Desktop.
class Post < ActiveRecord::Base
has_many :comments, :dependent => :destroy, :inverse_of => :post
accepts_nested_attributes_for :comments, :allow_destroy => true
end
class Comment < ActiveRecord::Base
belongs_to :post, :inverse_of => :comments
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment