adding slugs to schools and categories

This commit is contained in:
Jared Cosulich 2017-03-16 16:09:54 -04:00
parent 683fc31c5d
commit 1db61cd3e5
13 changed files with 42 additions and 12 deletions

View file

@ -68,12 +68,12 @@ class CategoriesController < ApplicationController
private
def set_school
redirect_to root_path and return false unless params.include?(:school_id)
@school = School.find(params[:school_id])
@school = School.friendly.find(params[:school_id])
redirect_to root_path and return false if @school.nil?
end
def set_category
@category = Category.find(params[:id])
@category = Category.friendly.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.