Sha256: e2adf3ed297460444b77f466a34d6e6292c3a5267aa5370686c3711921b81c8d
Contents?: true
Size: 771 Bytes
Versions: 1
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
json_api_helpers-0.1.0 | lib/json_api_helpers/action_dispatch_request_wrapper.rb |