Commit 9384e078
Changed files (1)
app
controllers
app/controllers/categories_controller.rb
@@ -2,6 +2,10 @@ class CategoriesController < ApplicationController
# GET /categories/fondant
def show
@category = Category.where(:slug => params[:id]).first
- @creations = Creation.joins(:categories).where(:categories => {:slug => params[:id]}).page(params[:page]).per(12)
+ if @category
+ @creations = Creation.joins(:categories).where(:categories => {:slug => params[:id]}).page(params[:page]).per(12)
+ else
+ redirect_to "/tags/#{params[:id]}"
+ end
end
end