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

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -