In config/routes.rb, I tried both:
root :to => 'things#index', :as => 'things'
and
root :to => 'things#index'
When I hit http://localhost:3000/, both approaches work, and nothing seems to be different.
What is the :as option used for?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The :as option forms a named route.
Usually it’s used in a non-root route. For example:
You could then do something like:
search_pathandsearch_urlare defined because of the:asFor a root route, you don’t really need
:asbecause the the URL helpersroot_pathandroot_urlare defined for you by Rails.