Sha256: bb94c9dc7167ee388dc95168671b05b6081e4fd164ebc31f3130f39f175ac3b5

Contents?: true

Size: 651 Bytes

Versions: 18

Compression:

Stored size: 651 Bytes

Contents

module ActiveRecord
  class PredicateBuilder
    def self.expand(klass, table, column, value)
      queries = []
      if klass && reflection = klass.reflect_on_association(column.to_sym)
        if reflection.polymorphic? && base_class = polymorphic_base_class_from_value(value)
          queries << build(table[reflection.foreign_type], base_class)
        end

        column = reflection.foreign_key
      end

      #CPK
      if Base === value && value.composite?
        queries << cpk_id_predicate(table, column, value.id)
      else
        queries << build(table[column], value)
      end
      queries
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
composite_primary_keys-7.0.16 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.15 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-8.1.1 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.14 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-8.1.0 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.13 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-8.0.0 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.12 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.11 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.10 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.9 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.8 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.7 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.6 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.5 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.4 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.3 lib/composite_primary_keys/relation/predicate_builder.rb
composite_primary_keys-7.0.2 lib/composite_primary_keys/relation/predicate_builder.rb