Routing Types are simple, default and root.
Simple
An example would be like:
get "demo/index"
which is a shortcut for
match "demo/index", :to => "demo#index"
this is saying when you get a request to go to: demo/index, to send to the controller#action (i.e. demo#index.)
Default
This separates the controller action and id with /
i.e. match ':controller(/:action(/:id(.:format)))'
Root
this is a similar match, but for the root of the application... such as:
root :to => "demo#index"
so this would say, when you hit the root of the application in a URL, it will route from this root to the controller#action.
Simple
An example would be like:
get "demo/index"
which is a shortcut for
match "demo/index", :to => "demo#index"
this is saying when you get a request to go to: demo/index, to send to the controller#action (i.e. demo#index.)
Default
This separates the controller action and id with /
i.e. match ':controller(/:action(/:id(.:format)))'
Root
this is a similar match, but for the root of the application... such as:
root :to => "demo#index"
so this would say, when you hit the root of the application in a URL, it will route from this root to the controller#action.
No comments:
Post a Comment