lib/api_authorization.rb
def not_authorized(message = 'You are not authorized', status = 403)
      respond_to do |format|
        format.json do
          return render json: { error: message }, status: status
        end
        format.html do
          return render html: "<h2> Forbidden #{status}</h2>".html_safe, status: status
        end
      end
    end
# a wrapper around respond_to helper that returns
# content as json, and html
#
# @params [String,Fixnum]
# @return [ActionController::MimeResponds]
a wrapper around respond_to helper that returns
content as json, and html
a wrapper around respond_to helper that returns content as json and html
def not_authorized(message = 'You are not authorized', status = 403)
      respond_to do |format|
        format.json do
          return render json: { error: message }, status: status
        end
        format.html do
          return render html: "<h2> Forbidden #{status}</h2>".html_safe, status: status
        end
      end
    end
def not_authorized ( message = 'You are not authorized' , status = 403 ) respond_to do | format | format . json do return render json : { error : message } , status : status end format . html do return render html : "<h2> Forbidden #{status}</h2>" . html_safe , status : status end end end
a wrapper around respond_to helper that returns
content as json, and html
a wrapper around respond_to helper that returns content as json and html
None
ActionController::MimeResponds
message
status
params
None