From the course: Ruby on Rails 6 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Define routes in a Ruby on Rails project

Define routes in a Ruby on Rails project - Ruby on Rails Tutorial

From the course: Ruby on Rails 6 Essential Training

Start my 1-month free trial

Define routes in a Ruby on Rails project

- [Instructor] In this movie, we will learn how Rails routing works. We saw the Rails architecture. If a web server can't find a static file in the public directory that matches the current request, then it sends the request on to the routing portion of the Rails framework. Rails routing examines the URL to determine which controller and action should be called. It does that using the definitions in the applications routes file. There is several types of route definitions. There's the simple match route. There's the default route. There's the root route and resourceful routes. We'll discuss the first three now and save the last one until later. The routes file is stored in config/routes.rb and if you look there now, you'll see an example of a simple match route because it was created when we generated our controller and view earlier. It says get and inside quotes, demo/index. This is a shorthand. The longer…

Contents