In Rails 5, whenever we define a belongs_to association, it is required to have the associated record present by default after this change. It triggers validation error if associated record is not present. 1 2class User < ApplicationRecord 3end 4 5class Post < ApplicationRecord 6 belongs_to :user 7end 8 9post = Post.create(title: 'Hi') 10=> <Post id: nil, title: "Hi", user_id: nil, created_at: nil