Sha256: 8797e8f871aec782962b1942fe78e04b0acb1c6dea46ff76be7b232ec5b52917
Contents?: true
Size: 771 Bytes
Versions: 3
Compression:
Stored size: 771 Bytes
Contents
# frozen_string_literal: true module JSONAPIHelpers # NOTE: # For some weird reason, ActiveModelSerializers call #original_url on # ActionDispatch::Request, which isn't defined. In order to avoid monkey matching, # this wrapper object delegates all methods to the request object and only adds one # method #request_url class ActionDispatchRequestWrapper < Delegator attr_reader :action_dispatch_request def initialize(request) super @action_dispatch_request = request end def __getobj__ @action_dispatch_request end def __setobj__(request) @action_dispatch_request = request end def request_url "#{@action_dispatch_request.base_url}#{@action_dispatch_request.path}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems