Creating Controllers and Actions

Creating Controllers and Actions

Controllers in Rails handle the logic between views and models.

  • Create with: rails generate controller Articles
  • Actions are public methods inside a controller, e.g., def index
  • Each action usually corresponds to a view template.

Controller files are located in app/controllers.

← PrevNext →