Ruby on Rails common Command / Instruction

Following are some common command / instruction that I have been using last 15 days as new ruby on rails developer.

1. To check Ruby Version

ruby -v

2. To create new rails project

rails new projectName

3. To start rails server

rails server

or

rails s

4. To generate model or controller

rails generate controller controllerName
rails generate model modelName

you can see the  what generate can do by the command

rails generate

. it will show like this

Rails:
assets
controller
generator
helper
integration_test
mailer
migration
model
observer
performance_test
resource
scaffold
scaffold_controller
session_migration
task

5. To create db or migrate db

rake db:create
rake db:migrate

6. You can also generate migration

rails generate migration migrationName

7. To go to db version or migrate to a version

rake db:migrate VERSION=version_number

8.Run server on different port

rails server -e development -p 3001

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>