Skip to content

Instantly share code, notes, and snippets.

@Znow
Created June 22, 2011 13:14
Show Gist options
  • Select an option

  • Save Znow/1040071 to your computer and use it in GitHub Desktop.

Select an option

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