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 @lecture = Lecture.new
18 @lecture.teacher = current_teacher
20 respond_to do |format|
21 format.html # new.html.haml
28 @lecture = Lecture.new params[:lecture]
29 @lecture.teacher = current_teacher
31 respond_to do |format|
33 format.html { redirect_to @lecture, :notice => I18n.t('lecture.created') }
35 format.html { render :action => 'new' }
41 # GET /lectures/1.json
43 @lecture = Lecture.find(params[:id])
45 respond_to do |format|
46 format.html # show.html.haml
47 format.json { render :json => @lecture }