Implicit helper creation - routes.rb and 'match'

I read Obie Fernandez "The Rails 3 Way", and there is little that I'm not sure I understand correctly. I am new to rails and want me to understand correctly. I have experience with vanilla ruby. Not many, but some.

The text in question is as follows: (regarding routing and the config / routes.rb file)

"...

By creating a route, for example

match 'auctions/:id' => "auction#show", :as => 'auction'

you get the opportunity to use good helper methods in situations such as

link_to item.description, auction_path(item.auction)

... "

My question is, which part match 'auctions/:id' => "auction#show", :as => 'auction'creates helper functions? (for example, link_to auctionand auction_path()) Is this part :as => 'auction'? Are any helpers created without adding :as => 'auction'?

, , , , , . match routes.rb ? :as => 'auction', match?

, , , , , . , .

+3
2

, :as => 'named_route', (, , ). , resources :something routes.rb? resources URL-, .

+1

:

match "alfa/beta", to: 'users#new'

, :as => 'named_route',

alfa_beta_path

, , users#new. , , , :as.

+2

All Articles