This may help to understand what named routes do.
Defining a named route creates a wrapper around url_ to provide the parameters needed for the created route. Routing resources create many named routes.
Given this, the overhead of calling a named route, unlike url_for with the necessary parameters, is negligible. Therefore, if you bind to a specific resource, then named routes are the way to go. They are easier to read, print and maintain.
However, do not drop url_for. It has many creative possibilities due to the way it handles missing parameters. This is very useful when it comes to storing DRY views that are used from multiple sub-sources. That is: when you have a blog_posts controller and a posts_controller controller using the same views.
I highly recommend you read url_for documentation . To help figure out where these places make sense to use url_for, follow these steps:
source share