Fix #2: Top Month Always Empty (archives_sidebar) #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for issue #2.
Issue: The top month of the archive month is always empty.
In archives_sidebar/_content.html.erb, line 8. Resolved-- by deleting +1 :
<%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]) +1 ) %>
<%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]) ) %>
This line included a +1 to month. This resulted in an off-by-1 error, which essentially pulls in article(s) from the NEXT month, which have not yet been published. By removing the +1, the top month is no longer empty. (although now I see a routing issue, where the month # in the route does not match the # of the current month.