module DatabaseValidations::PresenceKeyExtractor
Public Instance Methods
attribute_by_key(validator)
click to toggle source
@param [DatabaseValidations::DbPresenceValidator]
@return [Hash]
# File lib/database_validations/lib/presence_key_extractor.rb, line 8 def attribute_by_key(validator) validator.attributes.map do |attribute| reflection = validator.klass._reflect_on_association(attribute) key = reflection ? reflection.foreign_key : attribute [KeyGenerator.for_db_presence(key), attribute] end.to_h end