Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Created April 20, 2012 03:08
Show Gist options
  • Select an option

  • Save MichaelDrogalis/2425607 to your computer and use it in GitHub Desktop.

Select an option

Save MichaelDrogalis/2425607 to your computer and use it in GitHub Desktop.
def create
@post = Post.new(params[:post])
@post.user = current_user
respond_to do |format|
if @post.save
format.html { redirect_to @post, notice: 'Post was successfully created.' }
format.json { render json: @post, status: :created, location: @post }
else
format.html { render action: "new" }
format.json { render json: @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