Method: ActiveRecord::PredicateBuilder.references

Defined in:
activerecord/lib/active_record/relation/predicate_builder.rb

.references(attributes) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'activerecord/lib/active_record/relation/predicate_builder.rb', line 28

def self.references(attributes)
  attributes.each_with_object([]) do |(key, value), result|
    if value.is_a?(Hash)
      result << Arel.sql(key, retryable: true)
    elsif (idx = key.rindex("."))
      result << Arel.sql(key[0, idx], retryable: true)
    end
  end
end