Skip to content

Commit

Permalink
edited application_controller.rb
Browse files Browse the repository at this point in the history
edited application_controller.rb to use new hash syntax
  • Loading branch information
AfolabiOlaoluwa authored Nov 8, 2016
1 parent 8bbd7ae commit 0e93c28
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 5,25 @@ class ApplicationController < ActionController::Base

def not_found
if env["REQUEST_PATH"] =~ /^\/api/
render :json => {:error => "not-found"}.to_json, :status => 404
render json: {error: 'not-found'}.to_json, status: 404
else
render :json => {:error => "What you are looking for is not found."}.to_json, :status => 404
render json: {error: "What you are looking for is not found."}.to_json, status: 404
end
end

def exception
if env["REQUEST_PATH"] =~ /^\/api/
render :json => {:error => "internal-server-error"}.to_json, :status => 500
render json: {error: "internal-server-error"}.to_json, status: 500
else
render :json => {:error => "500 Internal Server Error"}.to_json, :status => 500
render json: {error: "500 Internal Server Error"}.to_json, status: 500
end
end

def unprocessable_entity
if env["REQUEST_PATH"] =~ /^\/api/
render :json => {:error => "internal-server-error"}.to_json, :status => 422
render json: {error: "internal-server-error"}.to_json, status: 422
else
render :text => "The change you wanted was rejected. Try to change only what to have access to", :status => 422
render text: "The change you wanted was rejected. Try to change only what to have access to", status: 422
end
end
end

0 comments on commit 0e93c28

Please sign in to comment.