{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/31437","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/31437/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/31437/comments","events_url":"https://api.github.com/repos/rails/rails/issues/31437/events","html_url":"https://github.com/rails/rails/issues/31437","id":281929378,"number":31437,"title":"Rails 5.1.4 Belongs_to validation","user":{"login":"adrian282","id":30219059,"avatar_url":"https://avatars3.githubusercontent.com/u/30219059?v=4","gravatar_id":"","url":"https://api.github.com/users/adrian282","html_url":"https://github.com/adrian282","followers_url":"https://api.github.com/users/adrian282/followers","following_url":"https://api.github.com/users/adrian282/following{/other_user}","gists_url":"https://api.github.com/users/adrian282/gists{/gist_id}","starred_url":"https://api.github.com/users/adrian282/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrian282/subscriptions","organizations_url":"https://api.github.com/users/adrian282/orgs","repos_url":"https://api.github.com/users/adrian282/repos","events_url":"https://api.github.com/users/adrian282/events{/privacy}","received_events_url":"https://api.github.com/users/adrian282/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2017-12-13T23:14:17Z","updated_at":"2018-03-26T22:25:44Z","closed_at":null,"author_association":"NONE","body":"If child association will fail on its validation rules then I receive ActiveRecord::NotNullViolation after parent save\r\n\r\n```\r\nclass Child\r\n  validates :name, presence: true, length: { in: 2..4 }\r\nend\r\n\r\nclass Parent \r\n  belongs_to :Child\r\nend\r\n\r\nparent = Parent.new\r\nparent.child = Child.new ( name: \"too long name\")\r\nparent.save\r\n```\r\n\r\nIn this case, belongs_to validation doesn't work"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/376331864","html_url":"https://github.com/rails/rails/issues/31437#issuecomment-376331864","issue_url":"https://api.github.com/repos/rails/rails/issues/31437","id":376331864,"user":{"login":"adrian282","id":30219059,"avatar_url":"https://avatars3.githubusercontent.com/u/30219059?v=4","gravatar_id":"","url":"https://api.github.com/users/adrian282","html_url":"https://github.com/adrian282","followers_url":"https://api.github.com/users/adrian282/followers","following_url":"https://api.github.com/users/adrian282/following{/other_user}","gists_url":"https://api.github.com/users/adrian282/gists{/gist_id}","starred_url":"https://api.github.com/users/adrian282/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrian282/subscriptions","organizations_url":"https://api.github.com/users/adrian282/orgs","repos_url":"https://api.github.com/users/adrian282/repos","events_url":"https://api.github.com/users/adrian282/events{/privacy}","received_events_url":"https://api.github.com/users/adrian282/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T22:25:44Z","updated_at":"2018-03-26T22:25:44Z","author_association":"NONE","body":"@victorhazbun  and ?"}}
{"actor":{"display_login":"adrian282"}}