Sha256: 828658d6b6d133e5dca9fead3c83c6b92be9bbb004ca178c6c783bf26c15a859

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

require 'backgrounder/support/backends'
require 'backgrounder/orm/base'
require 'backgrounder/delay'

module CarrierWave
  module Backgrounder
    include Support::Backends

    class UnsupportedBackendError < StandardError ; end
    class ToManyBackendsAvailableError < StandardError ; end

    def self.configure
      yield self
    end

  end
end

if defined?(Rails)
  module CarrierWave
    module Backgrounder
      class Railtie < Rails::Railtie

        initializer "carrierwave_backgrounder.active_record" do
          ActiveSupport.on_load :active_record do
            require 'backgrounder/orm/activemodel'
            ::ActiveRecord::Base.extend CarrierWave::Backgrounder::ORM::ActiveModel
          end
        end

        initializer "carrierwave_backgrounder.data_mapper", :before =>"data_mapper.add_to_prepare" do
          require 'backgrounder/orm/data_mapper' if defined?(DataMapper)
        end

        initializer "carrierwave_backgrounder.mongoid" do
          if defined?(Mongoid)
            require 'backgrounder/orm/activemodel'
            ::Mongoid::Document::ClassMethods.send(:include, ::CarrierWave::Backgrounder::ORM::ActiveModel)
          end
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
carrierwave_backgrounder-0.1.2 lib/carrierwave_backgrounder.rb
carrierwave_backgrounder-0.1.1 lib/carrierwave_backgrounder.rb
carrierwave_backgrounder-0.1.0 lib/carrierwave_backgrounder.rb