Created
August 26, 2013 00:05
-
-
Save DerekK19/6337090 to your computer and use it in GitHub Desktop.
Rails example commands to generate controllers and models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# typically any app would have these controllers | |
rails generate controller welcome index | |
# Assume we want a controller for "posts", which would be a group of "post" models | |
# A post has a title whcih is a string and content, which is a text | |
rails generate controller posts | |
rails generate model Post title:string content:text | |
# Assume we want a controller for "comments" which would be a group of "comment" models | |
# A comment has a commenter, which is a string, a body which is a text and a post, which is a reference (to a post) | |
rails generate controller comments | |
rails generate model Comment commenter:string body:text post:references |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment