[RUBY] Rough procedure verbalized output when creating an app with Rails

Rough steps when creating an app with Ruby on Rails

The purpose of this article is to roughly explain the procedure for creating an application in words. I created my study for my first time.

1. Preparation

Execute the following command in the terminal. ・ Rails new (version specification) (database you want to specify) -Cd (created directory)

2. Database creation

Execute the following command in the terminal. ・ Rails db: create ・ Rails s

3. Edit Gem file

If necessary, specify the Rails version and install the required Gem. After completion, do the following in your terminal as needed: ・ Bundle install ・ Bundle update

4. Creating a posting model

Do the following in your terminal: ・ Rails g model (model name)

5. Create table

Edit the migration file and describe the columns you want to create in the database. After completion, execute the following in the terminal. ・ Rails db: migrate

6. Settings for each action

Make settings for each action according to the following flow. -Routing settings · Define controller creation or action · Creating a view

Routing settings

resources :Controller name, only[:action]

If you want to narrow down the action, describe it in the part inside only.

Creating a controller

When creating a controller, write the following command in the terminal. ・ Rails g controller Controller name

Define the actions required for the controller. There are two points. -If you want to use the value obtained from the database in the view, assign the value to the instance variable and use it in the view. -Use strong parameters to save data.

View creation

The points are the following two points -Edit application.html.erb for header and footer layout. -For views for each action, create action name.html.erb in the views file and describe it.

Create an application according to the above flow.

Recommended Posts

Rough procedure verbalized output when creating an app with Rails
Summary of initial work when creating an app with Rails
How to specify db when creating an app with rails
Downgrade an existing app created with rails 5.2.4 to 5.1.6
Note: Cheat sheet when creating Rails Vue app
How to push an app developed with Rails to Github
How to get started with creating a Rails app
Creating an EC site with Rails5 ①-App configuration, various gem preparation, Model / Routing creation-
I want to push an app made with Rails 6 to GitHub
What to do when you launch an application with rails
Building an environment for creating apps with Rails and Vue
When a beginner makes a personal app with rails, the procedure to bring it to the starting point anyway.
[Rails] Avoid SELECT issued when creating a model with belongs_to defined!
Naming convention when creating a new controller or model with rails
Do not add @GeneratedValue unnecessarily when creating an Entity with JPA
[Rails] Creating a new project with rails new
About creating an application with springboot
Creating a timer app with a muddy
Create an app with Spring Boot
Precautions when creating PostgreSQL with docker-compose
Track Rails app errors with Sentry
[Ruby on Rails] Creating an inquiry form
[Rails6] Create a new app with Rails [Beginner]
Introduced Vue.js to an existing Rails app
When creating an app with the new command in Ruby on Rails bundler: failed to load command: spring (/ Users/user name/directory name to create the app/app name/vendor/bundle/ruby ​​/ 2.6.0/bin/spring )
Error when building infrastructure with aws app
[Rails 5] Create a new app with Rails [Beginner]
[AWS] Publish rails app with nginx + puma
Let's make an error screen with Rails
Introduced Vuetify to an existing Rails app
Try creating an iOS library with CocoaPods
The story of making an electronic New Year's card app with Vue.js + Rails
A memorandum when building an environment with Ruby3.0 x Rails6.1 x Docker x CentOS Stream