From 0e2c14518f2374f10ba55f2dfe8ed94a654db38b Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Mon, 20 Aug 2012 18:55:22 +0200 Subject: [PATCH] tiny urls redirection --- app/controllers/tiny_urls_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/tiny_urls_controller.rb b/app/controllers/tiny_urls_controller.rb index 4614fe3..21fd6e7 100644 --- a/app/controllers/tiny_urls_controller.rb +++ b/app/controllers/tiny_urls_controller.rb @@ -45,11 +45,11 @@ class TinyUrlsController < ApplicationController respond_to do |format| if @tiny_url.save - format.html { redirect_to @tiny_url, notice: 'Tiny url was successfully created.' } - format.json { render json: @tiny_url, status: :created, location: @tiny_url } + format.html { redirect_to tiny_urls_url, notice: 'Tiny url was successfully created.' } + else format.html { render action: "new" } - format.json { render json: @tiny_url.errors, status: :unprocessable_entity } + end end end @@ -61,11 +61,11 @@ class TinyUrlsController < ApplicationController respond_to do |format| if @tiny_url.update_attributes(params[:tiny_url]) - format.html { redirect_to @tiny_url, notice: 'Tiny url was successfully updated.' } - format.json { head :no_content } + format.html { redirect_to tiny_urls_url, notice: 'Tiny url was successfully updated.' } + else format.html { render action: "edit" } - format.json { render json: @tiny_url.errors, status: :unprocessable_entity } + end end end