Paths come with marketing and perception identity purpose, while controller-action is purely technical. Routes decouples these two parts to make it flexible and controller-action reusable.
Different paths may lead to same controller-action. That is where you need to apply :defaults
options to differentiate the paths. controller-action can check params
on the defaults. For example, both account creation form and account registration form can share the same accounts#new
. :default
can be set with usecase: creation
or usecase: registration
respectively.
:as
option is encouraged to apply, so that in your controller or view you can use named path/url to refer to the link. This sets flexibility when you change paths frequently. This is especially handy for routes in engine/plugin, since you cannot predicate how a hosting app set path for engine itself when in use.
No such thing like redirect in route. You can just refer the path to controller-action you want it to be. Example: `root 'cc\t