Sha256: bc76f295e30e5370c7d27ab82f5c42d62de457a74cab56a8d20182aac693fe0f

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

require 'active_support/concern'

module Praxis::Mapper
  module SequelCompat
    extend ActiveSupport::Concern

``    included do
      attr_accessor :_resource
    end

    module ClassMethods
      def _filter_query_builder_class
        Praxis::Extensions::SequelFilterQueryBuilder
      end

      def _praxis_associations
        orig = self.association_reflections.clone

        orig.each do |k,v|
          v[:model] = v.associated_class
          if v.respond_to?(:primary_key)
            v[:primary_key] = v.primary_key
          else
            # FIXME: figure out exactly what to do here. 
            # not super critical, as we can't track these associations
            # directly, but it would be nice to traverse these
            # properly.
            v[:primary_key] = :unsupported
          end
        end
        orig
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
praxis-2.0.pre.2 lib/praxis/mapper/sequel_compat.rb
praxis-2.0.pre.1 lib/praxis/mapper/sequel_compat.rb