Sha256: eb98ca7509284a4aeb8075702c93a0db07dae76965df70e4ee7c63588df9875e
Contents?: true
Size: 807 Bytes
Versions: 21
Compression:
Stored size: 807 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 @sections = Object.new # 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
21 entries across 21 versions & 2 rubygems