1 class SpeachesController < ApplicationController
2 before_filter :authenticate_author!, :except => [:index]
10 format.html # index.html.erb
11 format.json { render json: @speaches }
17 # GET /speaches/1.json
19 @speach = Speach.find(params[:id])
21 respond_to do |format|
22 format.html # show.html.erb
23 format.json { render json: @speach }
28 # GET /speaches/new.json
32 respond_to do |format|
33 format.html # new.html.erb
34 format.json { render json: @speach }
38 # GET /speaches/1/edit
40 @speach = Speach.find(params[:id])
46 @speach = Speach.new(params[:speach])
48 respond_to do |format|
50 format.html { redirect_to @speach, notice: 'Speach was successfully created.' }
51 format.json { render json: @speach, status: :created, location: @speach }
53 format.html { render action: "new" }
54 format.json { render json: @speach.errors, status: :unprocessable_entity }
60 # PUT /speaches/1.json
62 @speach = Speach.find(params[:id])
64 respond_to do |format|
65 if @speach.update_attributes(params[:speach])
66 format.html { redirect_to @speach, notice: 'Speach was successfully updated.' }
67 format.json { head :ok }
69 format.html { render action: "edit" }
70 format.json { render json: @speach.errors, status: :unprocessable_entity }
76 # DELETE /speaches/1.json
78 @speach = Speach.find(params[:id])
81 respond_to do |format|
82 format.html { redirect_to speaches_url }
83 format.json { head :ok }