Skip to content

Instantly share code, notes, and snippets.

@jsstrn
Created January 27, 2016 01:37
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 jsstrn/373c602cd881e218dc8d to your computer and use it in GitHub Desktop.
Save jsstrn/373c602cd881e218dc8d to your computer and use it in GitHub Desktop.

Create a new model for comments in app/models/comments.rb

class Comments < ActiveRecord::Base
  belongs_to :post
end

Create a migration file for comments:

rails generate migration CreateComments body:text post:references

Then run this command in the terminal to create your comments table in the database:

rake db:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment