Sha256: df16f04217634a744fd09114f6d1fad27757fdaff4d3ed151c5d5f13dc6975f7

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

module Refile
  module Backgrounder
    module ActiveRecord

      def attachment(name, background: false, worker: Refile::Backgrounder::StoreWorker, **options)
        super name, **options
        return unless background

        attr_accessor :_skip_refile_backgrounder
        after_save(unless: :_skip_refile_backgrounder) do |record|
          worker.perform_later record, name.to_s, metadata
        end
      end

    end
  end
end

require 'refile/attachment/active_record'
::ActiveRecord::Base.extend Refile::Backgrounder::ActiveRecord

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refile-backgrounder-0.0.3 lib/refile/backgrounder/activerecord.rb