Module: Dynamoid::Persistence::UpdateValidations

Defined in:
lib/dynamoid/persistence/update_validations.rb

Class Method Summary collapse

Class Method Details

.validate_attributes_exist(model_class, attributes) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/dynamoid/persistence/update_validations.rb', line 7

def self.validate_attributes_exist(model_class, attributes)
  model_attributes = model_class.attributes.keys

  attributes.each_key do |attr_name|
    unless model_attributes.include?(attr_name)
      raise Dynamoid::Errors::UnknownAttribute, "Attribute #{attr_name} does not exist in #{model_class}"
    end
  end
end