in lib/generators/aws_record/base.rb [96:131]
def ensure_hkey
uuid_member = nil
hkey_member = nil
rkey_member = nil
self.attributes.each do |attr|
if attr.options.key? :hash_key
if hkey_member
@parse_errors << ArgumentError.new("Redefinition of hash_key attr: #{attr.name}, original declaration of hash_key on: #{hkey_member.name}")
next
end
hkey_member = attr
elsif attr.options.key? :range_key
if rkey_member
@parse_errors << ArgumentError.new("Redefinition of range_key attr: #{attr.name}, original declaration of range_key on: #{hkey_member.name}")
next
end
rkey_member = attr
end
if attr.name.include? "uuid"
uuid_member = attr
end
end
if !hkey_member
if uuid_member
uuid_member.options[:hash_key] = true
else
self.attributes.unshift GeneratedAttribute.parse("uuid:hkey")
end
end
end