Sha256: be4d275747039ded1478d81f8e5f082d02a5b4fcbe2fd0f21ab88a6baf813144

Contents?: true

Size: 567 Bytes

Versions: 4

Compression:

Stored size: 567 Bytes

Contents

module Refile
  module Backgrounder
    module Attacher

      def background?
        record.respond_to? "#{name}_cache_id"
      end

      def cache_id
        super || (background? and record.send("#{name}_cache_id"))
      end

      def set(*)
        super
        save_cache_id
      end

      def store!
        super unless background?
      end

      def save_cache_id
        record.send "#{name}_cache_id=", cache_id if background?
      end

    end
 end
end

require 'refile/attacher'
::Refile::Attacher.send :prepend, Refile::Backgrounder::Attacher

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
refile-backgrounder-0.0.6 lib/refile/backgrounder/attacher.rb
refile-backgrounder-0.0.5 lib/refile/backgrounder/attacher.rb
refile-backgrounder-0.0.4 lib/refile/backgrounder/attacher.rb
refile-backgrounder-0.0.3 lib/refile/backgrounder/attacher.rb