Skip to content

Commit

Permalink
Don't throw exception when viewing empty tag.
Browse files Browse the repository at this point in the history
I'm settings my posts date to future as a replacement for the missing "draft" feature. If you do so the post will not be displayed in posts index or posts index by tag, but the tag will be visible in the navigation bar. Clicking a new for which the article isn't published yet causes an exception.

This commits makes it display "There are no posts yet".

The real fix to this problem would be filtering out tags with only unpublished posts, but this would either require a lot more coding or would slow down tag list terribly.
  • Loading branch information
Adam Wróbel authored and xaviershay committed Dec 3, 2010
1 parent f6a2209 commit a5d6c05
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions app/controllers/posts_controller.rb
Expand Up @@ -3,8 +3,6 @@ def index
@tag = params[:tag]
@posts = Post.find_recent(:tag => @tag, :include => :tags)

raise(ActiveRecord::RecordNotFound) if @tag && @posts.empty?

respond_to do |format|
format.html
format.atom { render :layout => false }
Expand Down

0 comments on commit a5d6c05

Please sign in to comment.