+ def foreign_key_attributes
+ attributes.keys.select { |a| a.match /_uuid$/ }
+ end
+
+ def normalize_collection_uuids
+ foreign_key_attributes.each do |attr|
+ attr_value = send attr
+ if attr_value.is_a? String and
+ attr_value.match /^[0-9a-f]{32,}(\+[@\w]+)*$/
+ begin
+ send "#{attr}=", Collection.normalize_uuid(attr_value)
+ rescue
+ # TODO: abort instead of silently accepting unnormalizable value?
+ end
+ end
+ end
+ end
+