Skip to content

Instantly share code, notes, and snippets.

@gaishimo
Created August 3, 2013 10:49
Show Gist options
  • Save gaishimo/6146071 to your computer and use it in GitHub Desktop.
Save gaishimo/6146071 to your computer and use it in GitHub Desktop.
Controller : render
respond_to do |format|
if @magazine.save
format.html { redirect_to @magazine, notice: 'Magazine was successfully created.' }
format.json { render json: @magazine, status: :created, location: @magazine }
else
format.html { render action: "new" }
format.json { render json: @magazine.errors, status: :unprocessable_entity }
end
end
def show
@magazine = Magazine.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @magazine }
end
end
render :json => {:notify_message => I18n.t('pages.not_found.body') },:status => 404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment