Sha256: 8537991b756438bb2f63352d4bc07c9133c97ec4d3150cb4a15b28c7170f61ef
Contents?: true
Size: 780 Bytes
Versions: 4
Compression:
Stored size: 780 Bytes
Contents
class PostsController < ApplicationController # GET /posts/1 # GET /posts/1.xml def show @post = Post.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } end end # POST /posts # POST /posts.xml def create # Have this line raise an exception @post = Post.nw(params[:post]) respond_to do |format| if @post.save format.html { redirect_to(post_path(@post), :notice => 'Post was successfully created.') } format.xml { render :xml => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems