DEV Community

Cover image for Blog Post 11 Anatomy of routes.rb
Edouble79
Edouble79

Posted on

Blog Post 11 Anatomy of routes.rb

Hello all! Since my last blog I have been digging deep into understanding Rails using VScode. The language seemed familiar from Ruby when I took the lessons at CodeCademy.

A couple of things I have learned in Rails is R.E.S.T. and GET.
Understanding the connection of the Request method and Path on how they make up the first half of a Rails route. The second part/half is the route action, the Ruby class and method that will take care of the incoming request.

Rails.application.routes.draw do
# verb 'path', to: 'controller#action'
get '/books', to: 'books#index'
end

I was able to break down the code by understanding that the verb was "GET", the 'path' was '/books', and the controller#action was the 'books#index' line. This code reminded me of the Ruby language I was learning in Codecademy and I was able to remember it but also apply it in a new curriculum I am learning with Rails.

Top comments (0)