Key learning:
Routes can be refactored quite simply! for example, the route
get ("/", ({ :controller => "controller_name", :action => "action_name"})
can be simplified to
root "controller_name#action_name"
Fundamentally, this works because the entire argument is just the method being applied to the hash relationship between the controller and the action.
Root is a specific method that works for the index file.
Top comments (2)
Can you explain why we use the url helper in the controller and not the path?
Questions: why do we not use the : in front of the prefix when we are embedding ruby into an html file?