Commit 75b8f0a5

mo khan <mo@mokhan.ca>
2014-06-13 16:44:42
add permanent redirect for google and other bots.
1 parent 8dea1f0
Changed files (1)
app/controllers/categories_controller.rb
@@ -1,6 +1,10 @@
 class CategoriesController < ApplicationController
   def show
     @category = Category.find_by_slug(params[:slug].downcase)
-    @creations = @category.creations.includes(:user).page(params[:page]).per(12)
+    if @category
+      @creations = @category.creations.includes(:user).page(params[:page]).per(12)
+    else
+      redirect_to creation_tag_path(params[:slug].downcase), status: :moved_permanently
+    end
   end
 end