Sha256: 797881908ad902ca99ddd4672702c00c48ba5e0ce190333f0ead0e2edfe9b335

Contents?: true

Size: 576 Bytes

Versions: 5

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

module Switchman
  module ActiveRecord
    module PredicateBuilder
      def convert_value_to_association_ids(value, primary_key)
        if value.is_a?(::ActiveRecord::Base)
          value.send(primary_key) # needed for sharded id translation
        else
          super
        end
      end

      module AssociationQueryValue
        def convert_to_id(value)
          case value
          when ::ActiveRecord::Base
            value.send(primary_key)
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
switchman-3.0.4 lib/switchman/active_record/predicate_builder.rb
switchman-3.0.3 lib/switchman/active_record/predicate_builder.rb
switchman-3.0.2 lib/switchman/active_record/predicate_builder.rb
switchman-3.0.1 lib/switchman/active_record/predicate_builder.rb
switchman-3.0.0 lib/switchman/active_record/predicate_builder.rb