Sha256: 9f152d2f19feb1ece3a42088723ab72e1ddb46f861e076f8c8bf836303edd006

Contents?: true

Size: 712 Bytes

Versions: 19

Compression:

Stored size: 712 Bytes

Contents

# frozen-string-literal: true

module Mobility
  module Plugins
    module ActiveRecord
=begin

Maps backend names to ActiveRecord namespaced backends.

=end
      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

19 entries across 19 versions & 1 rubygems

Version Path
mobility-1.3.1 lib/mobility/plugins/active_record/backend.rb
mobility-1.3.0 lib/mobility/plugins/active_record/backend.rb
mobility-1.3.0.rc3 lib/mobility/plugins/active_record/backend.rb
mobility-1.3.0.rc2 lib/mobility/plugins/active_record/backend.rb
mobility-1.3.0.rc1 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.9 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.8 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.7 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.6 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.5 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.4 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.3 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.2 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.1 lib/mobility/plugins/active_record/backend.rb
mobility-1.2.0 lib/mobility/plugins/active_record/backend.rb
mobility-1.1.3 lib/mobility/plugins/active_record/backend.rb
mobility-1.1.2 lib/mobility/plugins/active_record/backend.rb
mobility-1.1.1 lib/mobility/plugins/active_record/backend.rb
mobility-1.1.0 lib/mobility/plugins/active_record/backend.rb