{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/23854","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/23854/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/23854/comments","events_url":"https://api.github.com/repos/rails/rails/issues/23854/events","html_url":"https://github.com/rails/rails/issues/23854","id":136084108,"number":23854,"title":"Creating a record with create! with a missing required belongs_to relationship doesn't raise an error","user":{"login":"adamcooke","id":4765,"avatar_url":"https://avatars.githubusercontent.com/u/4765?v=3","gravatar_id":"","url":"https://api.github.com/users/adamcooke","html_url":"https://github.com/adamcooke","followers_url":"https://api.github.com/users/adamcooke/followers","following_url":"https://api.github.com/users/adamcooke/following{/other_user}","gists_url":"https://api.github.com/users/adamcooke/gists{/gist_id}","starred_url":"https://api.github.com/users/adamcooke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamcooke/subscriptions","organizations_url":"https://api.github.com/users/adamcooke/orgs","repos_url":"https://api.github.com/users/adamcooke/repos","events_url":"https://api.github.com/users/adamcooke/events{/privacy}","received_events_url":"https://api.github.com/users/adamcooke/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activerecord","name":"activerecord","color":"0b02e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-02-24T14:54:45Z","updated_at":"2016-04-04T01:04:45Z","closed_at":null,"body":"I've noticed that on Rails 5.0.0.beta2 that creating a new record using `Model.create!` doesn't raise any errors and creates an invalid record when there is a missing `belongs_to` relationship. \r\n\r\nThis assume that `belongs_to_required_by_default` is `true` and the `belongs_to` relationship doesn't specify any options for `optional` or `required` implying that it is required.\r\n\r\nIs this desired behaviour? I'd have thought this should raise a normal `ActiveRecord::RecordInvalid` exception."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/205092838","html_url":"https://github.com/rails/rails/issues/23854#issuecomment-205092838","issue_url":"https://api.github.com/repos/rails/rails/issues/23854","id":205092838,"user":{"login":"waits","id":972475,"avatar_url":"https://avatars.githubusercontent.com/u/972475?v=3","gravatar_id":"","url":"https://api.github.com/users/waits","html_url":"https://github.com/waits","followers_url":"https://api.github.com/users/waits/followers","following_url":"https://api.github.com/users/waits/following{/other_user}","gists_url":"https://api.github.com/users/waits/gists{/gist_id}","starred_url":"https://api.github.com/users/waits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waits/subscriptions","organizations_url":"https://api.github.com/users/waits/orgs","repos_url":"https://api.github.com/users/waits/repos","events_url":"https://api.github.com/users/waits/events{/privacy}","received_events_url":"https://api.github.com/users/waits/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T01:04:45Z","updated_at":"2016-04-04T01:04:45Z","body":"I started working on this issue in #24409."}}