def validate_attributes_schema
@attributes.keys.each do |key|
value = read_attribute(key)
next unless value
if (column = column_for_attribute(key)) and !key.ends_with?(":")
if column.collection?
unless value.is_a?(Array)
raise WrongAttributeDataType, "#{human_attribute_name(column.name)} has the wrong type. Expected collection of #{column.klass}. Record is #{value.class}"
end
value.each do |v|
validate_attribute_type(v, column)
end
else
validate_attribute_type(value, column)
end
else
@attributes.delete(key)
end
end
end