From 7e15d0cbfaede6b348793e8a7024f8f3bb9ccf38 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Wed, 22 Sep 2010 12:39:17 -0300 Subject: [PATCH] Fixed crash when searching for unexistent tag --- app/controllers/public/search_controller.rb | 4 ++-- features/tags.feature | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index 56505c3..b4da66d 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -223,10 +223,10 @@ class SearchController < PublicController end def tag - @tag = environment.tags.find_by_name(params[:tag]) + @tag = params[:tag] @tag_cache_key = "tag_#{CGI.escape(@tag.to_s)}_env_#{environment.id.to_s}_page_#{params[:npage]}" if is_cache_expired?(@tag_cache_key, true) - @tagged = environment.articles.find_tagged_with(@tag.name).paginate(:per_page => 10, :page => params[:npage]) + @tagged = environment.articles.find_tagged_with(@tag).paginate(:per_page => 10, :page => params[:npage]) end end diff --git a/features/tags.feature b/features/tags.feature index 30f7e94..afe324f 100644 --- a/features/tags.feature +++ b/features/tags.feature @@ -40,3 +40,7 @@ Feature: tags Scenario: viewing profile's content tagged When I go to /profile/joaoaraujo/tags/amazon Then I should see "the Amazon is being destroyed" + + Scenario: trying to view a tag not used + When I go to /tag/shark + Then I should see /Tagged with "shark"/ -- libgit2 0.21.2