ruby on rails - Where should a root be located in your routes.rb file? -


probably trivial wondering root key word along controller action should placed within routes.rb file.

rails.application.routes.draw   'welcome/index'    root 'welcome#index' end 

i've taken @ couple of tutorials , of them seem have @ bottom. there reason this?

according rails routing guide

you should put root route @ top of file, because popular route , should matched first.

and partial reasoning is

rails routes matched in order specified...

so, want commonly used routes on/high in file, don't have go through , waste time checking lot of uncommon or downright rare routes.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -