The #
in to: 'static_pages#about'
means about
action of static_pages_controller
. The syntax is controller#action
.
When you define get "/static_pages#about"
, static_pages#about
becomes the controller for the route i.e. the #
is only a character literal and #about
does not mean about
action. You should get a missing :controller
error if static_pages#about
controller does not exist.
The following route definition gives you /about
path which maps to static_pages/about
controller's about
action, where static_pages
could either be a namespace or a scope.
get 'about', to: 'static_pages/about', as: :about
The following route is invalid and should throw an error due to the leading slash /
in to
option.
get 'about', to: '/static_pages#about', as: :about