Method: ActionDispatch::Routing::Mapper::Base#root

Defined in:
lib/action_dispatch/routing/mapper.rb

#root(options = {}) ⇒ Object

You can specify what Rails should route “/” to with the root method:

root :to => 'pages#main'

For options, see the match method’s documentation, as root uses it internally.

You should put the root route at the top of config/routes.rb, because this means it will be matched first. As this is the most popular route of most Rails applications, this is beneficial.



258
259
260
# File 'lib/action_dispatch/routing/mapper.rb', line 258

def root(options = {})
  match '/', options.reverse_merge(:as => :root)
end