module ActionDispatch::Routing::Mapper::Resources

def root(path, options = {})

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

root 'pages#main'

You can also pass a string which will expand

For options, see `match`, as `root` uses it internally.

root to: 'pages#main'

You can specify what Rails should route "/" to with the root method:
def root(path, options = {})
  if path.is_a?(String)
    options[:to] = path
  elsif path.is_a?(Hash) && options.empty?
    options = path
  else
    raise ArgumentError, "must be called with a path and/or options"
  end
  if @scope.resources?
    with_scope_level(:root) do
      path_scope(parent_resource.path) do
        match_root_route(options)
      end
    end
  else
    match_root_route(options)
  end
end