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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -