app/controllers/courses_controller.rb
# All courses of a specific grade, ordered by name
All courses of a specific grade, ordered by name
All courses of a specific grade ordered by name
def indexByGrade
		@extra_name = " "+params[:gra].to_i.ordinalize+" grade"
		@description = "HYP School's "+params[:gra].to_i.ordinalize+" grade students can follow these courses, ordered alphabetically:";
		@courses = Course.where("grade = ?", params[:gra]).order("name").all.group_by{|c| c.name[0]}
		render 'index'
	end
def indexByGrade @extra_name = " " + params [ :gra ] . to_i . ordinalize + " grade" @description = "HYP School's " + params [ :gra ] . to_i . ordinalize + " grade students can follow these courses, ordered alphabetically:" ; @courses = Course . where ( "grade = ?" , params [ :gra ] ) . order ( "name" ) . all . group_by { | c | c . name [ 0 ] } render 'index' end
All courses of a specific grade, ordered by name
All courses of a specific grade ordered by name