Sha256: c4e927f4850bd5615b98dce9d150e25e3626edf72460e8023ffac4e391b7a74e

Contents?: true

Size: 642 Bytes

Versions: 9

Compression:

Stored size: 642 Bytes

Contents

# frozen-string-literal: true

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

9 entries across 9 versions & 1 rubygems

Version Path
mobility-1.0.7 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.6 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.5 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.4 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.3 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.2 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.1 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.0 lib/mobility/plugins/active_record/backend.rb
mobility-1.0.0.rc1 lib/mobility/plugins/active_record/backend.rb