Sha256: 31fa7dcb360a54996963da5fa2378ffe03abf05ed74815138d1f3fea87c58213

Contents?: true

Size: 611 Bytes

Versions: 3

Compression:

Stored size: 611 Bytes

Contents

module Mobility
  module Plugins
    module ActiveRecord
      module Backend
        extend Plugin

        requires :backend, include: :before

        def load_backend(backend)
          if Symbol === backend
            require "mobility/backends/active_record/#{backend}"
            Backends.load_backend("active_record_#{backend}".to_sym)
          else
            super
          end
        rescue LoadError => e
          raise unless e.message =~ /active_record\/#{backend}/
          super
        end
      end
    end

    register_plugin(:active_record_backend, ActiveRecord::Backend)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mobility-1.0.0.beta2 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.0.beta1 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.0.alpha lib/mobility/plugins/active_record/backend.rb