Sha256: 2e5fb78fe4a50c195d5753265489fbef1b284e9b0de6a93f148dbf46e2402dc7

Contents?: true

Size: 971 Bytes

Versions: 5

Compression:

Stored size: 971 Bytes

Contents

module Draper
  module Compatibility
    # [Active Job](http://edgeguides.rubyonrails.org/active_job_basics.html) allows you to pass
    # ActiveRecord objects to background tasks directly and performs the necessary serialization
    # and deserialization. In order to do this, arguments to a background job must implement
    # [Global ID](https://github.com/rails/globalid).
    #
    # This compatibility patch implements Global ID for decorated objects by delegating to the object
    # that is decorated. This means you can pass decorated objects to background jobs, but 
    # the object won't be decorated when it is deserialized. This patch is meant as an intermediate
    # fix until we can find a way to deserialize the decorated object correctly.
    module GlobalID
      extend ActiveSupport::Concern

      included do
        include ::GlobalID::Identification

        delegate :to_global_id, :to_signed_global_id, to: :object
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
draper-4.0.2 lib/draper/compatibility/global_id.rb
draper-4.0.1 lib/draper/compatibility/global_id.rb
draper-4.0.0 lib/draper/compatibility/global_id.rb
draper-3.1.0 lib/draper/compatibility/global_id.rb
draper-3.0.1 lib/draper/compatibility/global_id.rb