Sha256: f30229a122bbee70cf855016c3c40c5a87bb6e95bf1a066e0c33327ffe638c9c

Contents?: true

Size: 636 Bytes

Versions: 2

Compression:

Stored size: 636 Bytes

Contents

class Ecm::Courses::CourseCategoriesController < ApplicationController
  def index
    @course_categories = Ecm::Courses::CourseCategory.all
  end

  def show
    @year = params[:year] ||= Time.zone.now.year
    @month = params[:month] ||= Time.zone.now.month

    @date = Date.strptime("#{@month}-#{@year}", "%m-%Y")

    @course_category = ::Ecm::Courses::CourseCategory.includes(:ecm_courses_courses => [ :ecm_courses_course_dates ]).find(params[:id])
    @courses = @course_category.ecm_courses_courses.all
    @course_dates = @courses.reduce([]) { |cd, c| cd << c.ecm_courses_course_dates.for_month(@date).all }.flatten
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ecm_courses-0.0.1 app/controllers/ecm/courses/course_categories_controller.rb
ecm_courses-0.0.7.pre app/controllers/ecm/courses/course_categories_controller.rb