Sha256: 7163b1b224411006b2f17e1373d12a540b02943d6fe52b0ff7bd81677dceef47
Contents?: true
Size: 1.98 KB
Versions: 12
Compression:
Stored size: 1.98 KB
Contents
class ContentsController < ApplicationController # GET /contents # GET /contents.xml def index @contents = Content.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @contents } end end # GET /contents/1 # GET /contents/1.xml def show @content = Content.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @content } end end # GET /contents/new # GET /contents/new.xml def new @content = Content.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @content } end end # GET /contents/1/edit def edit @content = Content.find(params[:id]) end # POST /contents # POST /contents.xml def create @content = Content.new(params[:content]) respond_to do |format| if @content.save flash[:notice] = 'Content was successfully created.' format.html { redirect_to(@content) } format.xml { render :xml => @content, :status => :created, :location => @content } else format.html { render :action => "new" } format.xml { render :xml => @content.errors, :status => :unprocessable_entity } end end end # PUT /contents/1 # PUT /contents/1.xml def update @content = Content.find(params[:id]) respond_to do |format| if @content.update_attributes(params[:content]) flash[:notice] = 'Content was successfully updated.' format.html { redirect_to(@content) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @content.errors, :status => :unprocessable_entity } end end end # DELETE /contents/1 # DELETE /contents/1.xml def destroy @content = Content.find(params[:id]) @content.destroy respond_to do |format| format.html { redirect_to(contents_url) } format.xml { head :ok } end end end
Version data entries
12 entries across 11 versions & 3 rubygems