2023-05-22 - Rails Intro


main topics


Starting with Rails

Starting a Rails App:

rails new ${app_name} \
  --skip-active-storage \
  --skip-action-mailbox

# launch the server
rails server

# generate a new controller
rails generate controller ${controller_name}

# check routes
rails routes

Most important files:

.
├── app
│   ├── controllers
│   │   └── application_controller.rb
│   ├── models
│   └── views
│       └── layouts
│           └── application.html.erb
└── config
    ├── database.yml
    └── routes.rb

Always start in the routes.rb.

MVC Review

Rails Intro - MVC Review.png

Action View Convention

Rails Intro - Action View Convention.png

Usual flow

Routes -> Controller -> View