This is an excerpt from the Ruby on Rails 5 Quick Learning Practice Guide that can be used in the field.
| Command name | Explanation |
|---|---|
| rails new app_name | Create a new Rails app |
| rails new app_name -m https://raw.github.com/ Atelier-Mirai/rengeso/ main/rengeso.rb |
Rails app creation from template |
| rails -h | Show Rails help |
| rails -v | Show Rails version |
| rails s | Server startup |
| rails s -p 3001 | Start another server |
| rails c | Console launch |
| rails c -s | Console launch(sandbox) |
| rails db | Start database console |
| show-routes --grep user | (Run in console) Show routing for user |
| show-model User | (Run in console) User model attribute display |
| rails g migration CreateBooks title:string describe:text |
Creating a migration file template |
| rails g model Book title:string describe:text | model(And migration files)Template creation |
| rails g controller Books index new create | controller(And views, helpers Creating a template for assets and test files) |
| rails g scaffold Book title:string describe:text | Create a set of models, controllers, etc. |
| rails d scaffold Book | Delete a set of models, controllers, etc. |
| rails db:create | Database creation |
| rails db:drop | Database deletion |
| rails db:migrate | Execution of migration file |
| rails db:seed | db/seed.Input data by rb |
| rails r sample.rb | Execution of Ruby code. Used for batch processing using models. |
| rails stats | Various statistics display of Rails application |
| rails g system_test users | Creating a system test template |
| rails test test/system/users_test.rb | Run specific system tests |
| rails test:system | (All of)Run system tests |
| rails g test_unit:model user | Creating a model test template |
| rails test test/models/user_test.rb | Run a specific model test |
| rails test | (Other than system testing)Run the test |
[Ruby on Rails 5 quick learning practice guide that can be used in the field](https://www.amazon.co.jp/ Can be used in the field-Ruby-Rails-5 quick learning practice guide-Neiko Oba / dp / 4839962227)
Recommended Posts