Ruby on Rails Routing

Just wanted to know what this line means in the routes.rb file:

AppName::Application.routes.draw do

Please explain. I am new to Rails.

+4
source share
2 answers

Read this page . Basically, in the block passed to Application.routes.draw (which is just a call to the method defined in the ActionDispatch :: Routing module in the main Rails structure), you define all the URLs / paths that you want your Rails application to reacted to.

You can view all of these route definitions by doing:

rake routes

in your terminal.

+1
source

, . , ruby ​​ rails ,

 root to: "controllername#index"

 resources: "model_name"

rails

get 'courses/index'

, .

0

Source: https://habr.com/ru/post/1616182/


All Articles