1 class LecturesController < ApplicationController
5 if params[:ids] and params[:ids].is_a? Array
6 @lectures = Lecture.where :id => params[:ids]
7 render json: @lectures.as_json(:methods => [:tasks])
9 @lectures = Lecture.all
10 render json: @lectures
17 respond_to do |format|
18 format.html { redirect_to root_path, :alert => I18n.t('teacher.not') }
22 @lecture = Lecture.new
23 @lecture.teacher = current_teacher
25 respond_to do |format|
26 format.html # new.html.haml
33 respond_to do |format|
35 format.html { redirect_to root_path, :alert => I18n.t('teacher.not') }
38 @lecture = Lecture.new params[:lecture]
39 @lecture.teacher = current_teacher
42 format.html { redirect_to @lecture, :notice => I18n.t('lecture.created') }
44 format.html { render :action => 'new' }
51 # GET /lectures/1.json
53 @lecture = Lecture.find(params[:id])
55 respond_to do |format|
56 format.html # show.html.haml
57 format.json { render :json => @lecture }