Created
December 8, 2010 16:55
-
-
Save dennermiranda/733546 to your computer and use it in GitHub Desktop.
Create
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@post = Post.new(params[:post]) | |
respond_to do |format| | |
if @post.save | |
format.html { redirect_to(@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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment