Sha256: 69f71b23740ea4dca7235f95ef9b6cc679f748a06b9841a3db40b8a5f8b2d5fd

Contents?: true

Size: 583 Bytes

Versions: 24

Compression:

Stored size: 583 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 PolymorphicArrayValue
        def convert_to_id(value)
          case value
          when ::ActiveRecord::Base
            value.send(primary_key(value))
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
switchman-3.6.7 lib/switchman/active_record/predicate_builder.rb
switchman-3.6.6 lib/switchman/active_record/predicate_builder.rb
switchman-3.6.5 lib/switchman/active_record/predicate_builder.rb
switchman-3.6.3 lib/switchman/active_record/predicate_builder.rb
switchman-3.6.2 lib/switchman/active_record/predicate_builder.rb
switchman-3.6.1 lib/switchman/active_record/predicate_builder.rb
switchman-3.6.0 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.22 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.21 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.20 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.19 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.18 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.17 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.16 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.15 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.14 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.13 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.12 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.11 lib/switchman/active_record/predicate_builder.rb
switchman-3.5.10 lib/switchman/active_record/predicate_builder.rb