Running rake routes
with a new rails application displays no information.
Rake routes should display to the user:
- No routes have been defined
- Recommend to the user that they define routes within their routes file (i.e.
config/routes.rb
) - Provide additional documentation about defining routes
- Provide links to documentation about defining routes
Rake routes displays output in a columized format. The layout of this information is not common knowledge to new Rails users.
Rake routes displays header information for each column.
HELPER PREFIXES | HTTP VERB | URL PATTERN | CONTROLLER#ACTION
Defining a delete link is far different then every other link the user usually generates while working with Rails.
Ideally the user would be able to use a helper method
link_to "Delete", delete_article_path(article)
I realize that this would likely be a difficult helper method to create and make work with the current infrastructure as all trailing parameters are used to define the additional, necessary parameters.
When the user sends the render message with a partial form name and the partial form is missing. The current error message tells the user to define a file with a path that will not actually work with partial forms as it is missing the '_' file prefix.
The error message should tell the user to define a form with the correct path that includes the initial underscore.
Partial forms can use a shorter syntax simply calling the render method with a string.
<%= render "articles/comment" %>
A user is required to use the hash syntax when they want to include additional parameters:
<%= render partial: "articles/comment", collection: @article.comments %>
Users that attempt to provide parameters to partial forms with the first version will receive an error.
<%= render "articles/comment", collection: @article.comments %>
Allow the following version to also work:
<%= render "articles/comment", collection: @article.comments %>
A user defines a controller action which attempts to save the item that they are building. If they add validations to the model and that model fails validations when they send:
redirect_to article_path(@article)
An error is generating that it could not find a path:
No route matches {:action=>"show", :controller=>"articles", :id=>#<Article id: nil, title: "", body: "", created_at: nil, updated_at: nil>}
The user is presented with a better error message that tells the user the path could not be viewed because the object did had a nil id value.
It appears that
redirect_to article_path(@article)
goes to/articles/
now.