Rails custom routes, the point of the as: symbol? -


in example, point of as: :logout parameter?

get 'logout', to: 'devise/registrations#destroy', as: :logout 

in views, can call route specifying logout_path. as: :logout parameter that's doing this?

exactly, can specify how want path named using as in routes.

you can read more naming routes here.

the as parameter doesn't need match in path or action:

get 'get-me-outta-here', to: 'devise/sessions#destroy', as: :logout # note logging out devise sessions not registrations 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

php - Dynamic url re-writing using htaccess -

java - Multi-Label Document Classification -