Commit 13837277

mo khan <mo@mokhan.ca>
2013-07-02 16:28:11
redirect to the tags controller if the category is not found
1 parent 477b1e2
Changed files (1)
app/controllers/categories_controller.rb
@@ -1,7 +1,11 @@
 class CategoriesController < ApplicationController
   def show
     @category = Category.find_by_slug(params[:slug].downcase)
-    @categories = Category.all
-    @creations = @category.creations.includes(:user).page(params[:page]).per(12)
+    if @category
+      @categories = Category.all
+      @creations = @category.creations.includes(:user).page(params[:page]).per(12)
+    else
+      redirect_to creation_tag_path(params[:slug].downcase)
+    end
   end
 end