2023-05-22 - Rails Intro
main topics
- Rails
- CLI
- MVC
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
Action View Convention
Usual flow
Routes -> Controller -> View