rails/rails — pull request #7876 by fsword (2012-10-08 19:33:10+00:00)
Title: add origin type to error message

Normalize_message will return the localized string for input parameter,
so the origin value will be lost.
This patch will add the origin type to message object, then you can use
type(more progrmability) to check validate result.
it will be used like this:
```ruby
post = Post.create(params...)
if post.valid?
status 200
......
elsif post.errors.values.flatten.map(&:type).include? :taken
status 409
......
else
status 400
end
```