123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::Encryption::ExtendedDeterministicQueries::RelationQueries

Instance Method Summary

Instance Method Details

#exists?(*args) ⇒ Boolean

[ GitHub ]

  
# File 'activerecord/lib/active_record/encryption/extended_deterministic_queries.rb', line 100

def exists?(*args)
  super(*EncryptedQuery.process_arguments(self, args, true))
end

#scope_for_create

[ GitHub ]

  
# File 'activerecord/lib/active_record/encryption/extended_deterministic_queries.rb', line 104

def scope_for_create
  return super unless klass.deterministic_encrypted_attributes&.any?

  scope_attributes = super
  wheres = where_values_hash

  klass.deterministic_encrypted_attributes.each do |attribute_name|
    attribute_name = attribute_name.to_s
    values = wheres[attribute_name]
    if values.is_a?(Array) && values[1..].all?(AdditionalValue)
      scope_attributes[attribute_name] = values.first
    end
  end

  scope_attributes
end

#where(*args)

[ GitHub ]

  
# File 'activerecord/lib/active_record/encryption/extended_deterministic_queries.rb', line 96

def where(*args)
  super(*EncryptedQuery.process_arguments(self, args, true))
end