Rails JSON Deserialization Invalid
Rails JSON deserialization seems to be creating invalid JSON when serializing errors. For example, the followi开发者_StackOverflowng snippet appears correct as a hash but incorrect as json:
@model.errors
# { message: ["it too short (minimum is 2 characters)", "contains inappropriate content"] }
@model.errors.to_json
# {
# message: "is too short (minimum is 2 characters)",
# message: "contains inapproriate content",
# }
Am I incorrect in understanding that keys must be unique? Thanks.
Problem with an outdated version of Rails (3.0.3). Updated to 3.0.9 and everything worked.
精彩评论