public
anonymous / gist:3078792
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
class EthosController < ApplicationController
before_filter :require_user, :only => [:create, :new, :edit, :update]
def index
@ethos = Etho.all
@etho = Etho.new
 
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @ethos }
end
end
 
 
def new
@etho = current_user.etho
 
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @etho }
end
end
 
def edit
@etho = Etho.find(params[:etho])
end
 
def create
@etho = Etho.new(params[:etho])
@etho.user = current_user
 
respond_to do |format|
if @etho.save
format.html { redirect_to(:back, :notice => 'Ethos was successfully created.') }
format.xml { render :xml => @etho, :status => :created, :location => @etho }
else
format.html { render :action => "new" }
format.xml { render :xml => @etho.errors, :status => :unprocessable_entity }
end
end
end
def show
end
 
def update
@etho = Etho.find(params[:id])
 
respond_to do |format|
if @etho.update_attributes(params[:etho])
format.html { redirect_to(:back, :notice => 'Ethos was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @etho.errors, :status => :unprocessable_entity }
end
end
end
 
def destroy
@etho = Etho.find(params[:id])
@etho.destroy
 
respond_to do |format|
format.html { redirect_to(ethos_url) }
format.xml { head :ok }
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.