Sha256: 6af11a9a3ff175667e7e62ba7cd9f55c2ba4004b90553cfe36b9b5b7499669cb

Contents?: true

Size: 504 Bytes

Versions: 12

Compression:

Stored size: 504 Bytes

Contents

module Api
  class CoursesController < BaseController
    before_action :set_new_course!, only: :create
    before_action :authorize_janitor!, only: :create

    def create
      @course.save!
      render json: @course
    end

    private

    def course_params
      params.require(:course).permit(:slug, :code, :period, :description, shifts: [], days: [])
    end

    def set_new_course!
      @course = Course.new course_params
    end

    def protection_slug
      @course.slug
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mumuki-laboratory-8.6.1 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.6.0 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.5.0 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.4.0 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.3.0 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.2.1 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.2.0 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.1.3 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.1.2 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.1.1 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.1.0 app/controllers/api/courses_controller.rb
mumuki-laboratory-8.0.0 app/controllers/api/courses_controller.rb