Basic Rails commands you want to learn

Basic Rails commands you want to learn

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
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]( Can be used in the field-Ruby-Rails-5 quick learning practice guide-Neiko Oba / dp / 4839962227)

Recommended Posts

Basic Rails commands you want to learn
[Rails] Learn yield to understand content_for
Until you introduce fonts to Rails
[PostgreSQL] If you want to delete the Rails app, delete the database first!
When you want Rails to disable a session for a specific controller only
If you want to modify database columns etc.
When you want to bind InputStream in JDBI3
Docker basic commands
When you want to use the method outside
I want to play with Firestore from Rails
Rails Reverse Lookup Dictionary (Gives what you want)
Rails basic philosophy
How to check Rails commands in the terminal
[Rails] I want to load CSS with webpacker
[Ruby] When you want to replace multiple characters
[rails] After option useful when you want to change the order of DB columns
If you want to separate Spring Boot + Thymeleaf processing
I want to use a little icon in Rails
I want to authenticate users to Rails with Devise + OmniAuth
An introductory book to read when you start Rails
If you want to use Mockito with Kotlin, use mockito-kotlin
I want to define a function in Rails Console
When you want to dynamically replace Annotation in Java8
If you want to recreate the instance in cloud9
[Ruby + Rails] When you want to register in Mailchimp's mail list together with user registration
How to write Rails
Introducing CircleCI to Rails
Introducing Bootstrap to Rails 5
Introducing Bootstrap to Rails !!
Introduce Vue.js to Rails
How to uninstall Rails
Nice to meet you.
What to do if you get an error in Basic authentication during Rails test code
[Rails] [bootstrap] I want to change the font size responsively
I want to push an app made with Rails 6 to GitHub
What to do when you launch an application with rails
If you want to study programming at university, go to Australia
Java study site summary that you want to read carefully
[# 3 Java] Read this if you want to study Java! ~ Carefully selected ~
I want to create a form to select the [Rails] category
Rails: You need to supply at least one validation error
# What to do if you accidentally do rails db: migrate: drop
[Rails] I want to display "XX minutes ago" using created_at!
When you want to explicitly write OR or AND with ransack
When you want to change the MySQL password of docker-compose
docker-compose.yml when you want to keep mysql running with docker
lombok.config when you want to pass @Qualifier to @RequiredArgsConstructor with lombok
Delegate is convenient to use when you want to reuse parts
What to do if you can't use the rails command
How to write when you want to keep line breaks and output while avoiding XSS in Rails
If you are new to Rails and want to make your own validation, stop by this finger.
[Output] Learn Ruby from what you want to do at the fastest speed-Part 2 "Create a flowchart"