Sha256: b3647e901d4de82a189edc800d954ffb3a81231160341f469159d542b7d04947
Contents?: true
Size: 904 Bytes
Versions: 9
Compression:
Stored size: 904 Bytes
Contents
module RailsConnector class WebserviceController < ActionController::Base rescue_from ClientError do |exception| render json: {error: exception.message}, status: exception.http_code end before_filter :merge_correctly_parsed_json_params before_filter :authorize private def authorize unless allow_access? render text: 'Forbidden', status: 403 end end # If +true+, allow access to ObjsController, else deny access. # See {RailsConnector::Configuration.editing_auth} for details. # @return [Bool] def allow_access? Configuration.editing_auth_callback.call(request.env) end # Workaround for https://github.com/rails/rails/issues/8832 def merge_correctly_parsed_json_params if request.format.json? body = request.body.read request.body.rewind params.merge!(ActiveSupport::JSON.decode(body)) if body.present? end end end end
Version data entries
9 entries across 9 versions & 1 rubygems