Most Common Rails Commands for Use in Terminal/Console
rails new name_of_app
(make a new app called “name_of_app”)
cd name_of_app
(get yerself into your app directory)
rake tmp:clear
(clear the cache)
rake assets:clean && rake assets:precompile && rails s
(get your css house in order and start the server)
rake routes > doc/routes.txt
(print all your routes to text file for easy reading)
rails s -p 3001
(start the local server on a different non-standard port, in this case port 3001)
reload!
(reload rails console, rails c, without restarting)
rails generate scaffold NAME [field[:type][:index] field[:type][:index]] [options]
(generate the whole shootin’ match: model, database migration for that model, controller to manipulate it, views to view and manipulate the data, and a test suite for each of the above)
rails generate migration add_column_to_table column:string
(add a column, in this case a variable named column that is a string, to an existing database table; many other variables may be added and used to reduce the rewrite before performing a “rake db:migrate” in terminal to actually alter the database)
rails generate controller section_name index
(add a controller; same as above with variables)
rake db:migrate
(build the database using your specified migrations)
rake db:rollback
(rollback last db:migrate)
bundle install
(gems added to gem file entered into gem.lock)
bundle update
(gems removed from gem file removed from gem.lock)