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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -