{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/18322","labels_url":"https://api.github.com/repos/rails/rails/issues/18322/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/18322/comments","events_url":"https://api.github.com/repos/rails/rails/issues/18322/events","html_url":"https://github.com/rails/rails/pull/18322","id":53330599,"number":18322,"title":"Add ActiveModel::Errors#codes","user":{"login":"morgoth","id":10766,"avatar_url":"https://avatars.githubusercontent.com/u/10766?v=3","gravatar_id":"","url":"https://api.github.com/users/morgoth","html_url":"https://github.com/morgoth","followers_url":"https://api.github.com/users/morgoth/followers","following_url":"https://api.github.com/users/morgoth/following{/other_user}","gists_url":"https://api.github.com/users/morgoth/gists{/gist_id}","starred_url":"https://api.github.com/users/morgoth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morgoth/subscriptions","organizations_url":"https://api.github.com/users/morgoth/orgs","repos_url":"https://api.github.com/users/morgoth/repos","events_url":"https://api.github.com/users/morgoth/events{/privacy}","received_events_url":"https://api.github.com/users/morgoth/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activemodel","name":"activemodel","color":"00E5FF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2015-01-04T09:09:24Z","updated_at":"2015-01-06T09:20:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/18322","html_url":"https://github.com/rails/rails/pull/18322","diff_url":"https://github.com/rails/rails/pull/18322.diff","patch_url":"https://github.com/rails/rails/pull/18322.patch"},"body":"To be able to return type of validator, one can now call `details`\r\non Errors instance:\r\n\r\n```ruby\r\nclass User < ActiveRecord::Base\r\n  validates :name, presence: true\r\nend\r\n```\r\n\r\n```ruby\r\nuser = User.new; user.valid?; user.errors.details\r\n=> {name: [{error: :blank}]}\r\n```\r\n\r\nThe first attempt was to return structure similar to messages, like: `{name: [:invalid, :blank]}`, but there was problem with missing additional options such as `:count` in some validators.\r\n\r\nIf the idea is accepted I will add documentation and changelog.\r\n\r\nThere is ongoing discussion on https://groups.google.com/forum/#!topic/rubyonrails-core/0lxM684Tqas"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/68842771","html_url":"https://github.com/rails/rails/pull/18322#issuecomment-68842771","issue_url":"https://api.github.com/repos/rails/rails/issues/18322","id":68842771,"user":{"login":"morgoth","id":10766,"avatar_url":"https://avatars.githubusercontent.com/u/10766?v=3","gravatar_id":"","url":"https://api.github.com/users/morgoth","html_url":"https://github.com/morgoth","followers_url":"https://api.github.com/users/morgoth/followers","following_url":"https://api.github.com/users/morgoth/following{/other_user}","gists_url":"https://api.github.com/users/morgoth/gists{/gist_id}","starred_url":"https://api.github.com/users/morgoth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/morgoth/subscriptions","organizations_url":"https://api.github.com/users/morgoth/orgs","repos_url":"https://api.github.com/users/morgoth/repos","events_url":"https://api.github.com/users/morgoth/events{/privacy}","received_events_url":"https://api.github.com/users/morgoth/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T09:20:40Z","updated_at":"2015-01-06T09:20:40Z","body":"Can we all agree on one naming? I already changed documentation examples, so it would be the last change in this PR."}}