Sha256: ef74836c72750e8d83a5bd2c3b128336513caac8207ea8baf09f2a0d69b227b0

Contents?: true

Size: 500 Bytes

Versions: 3

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

module Dynamoid
  module Persistence
    # @private
    module UpdateValidations
      def self.validate_attributes_exist(model_class, attributes)
        model_attributes = model_class.attributes.keys

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dynamoid-3.8.0 lib/dynamoid/persistence/update_validations.rb
dynamoid-3.7.1 lib/dynamoid/persistence/update_validations.rb
dynamoid-3.7.0 lib/dynamoid/persistence/update_validations.rb