I really liked your response, but I think it needs a small improvement - one needs to iterate over hasMany attribute to collect all values (following code is written in CoffeeScript):
serializeHasMany: (snapshot, json, relationship) ->
@_super snapshot, json, relationship
key = @keyForRelationship relationship.key, "hasMany" # with provided keyForRelationship() implementation
for value, index in json[key]
json[key][index] = parseInt value