Sha256: 43a1c3af2b7d2ad52d0b3f6443a776bd1a1728d5efbebceb190d6cfb11bc89d6

Contents?: true

Size: 537 Bytes

Versions: 4

Compression:

Stored size: 537 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
        end
      end

    end
  end
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refile-backgrounder-0.0.6 lib/refile/backgrounder/activerecord.rb
refile-backgrounder-0.0.5 lib/refile/backgrounder/activerecord.rb
refile-backgrounder-0.0.4 lib/refile/backgrounder/activerecord.rb
refile-backgrounder-0.0.1 lib/refile/backgrounder/activerecord.rb