Sha256: 0a288ec0a74172ed6ec0fc68e0a0b77df291eea3eaef285b6f084ae143d0c7b2

Contents?: true

Size: 575 Bytes

Versions: 10

Compression:

Stored size: 575 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

10 entries across 10 versions & 1 rubygems

Version Path
switchman-2.0.12 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.11 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.10 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.9 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.8 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.7 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.6 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.5 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.3 lib/switchman/active_record/predicate_builder.rb
switchman-2.0.2 lib/switchman/active_record/predicate_builder.rb