class ActiveModel::MissingAttributeError

# => ActiveModel::MissingAttributeError: missing attribute ‘user_id’ for Pet
user.pets.select(:id).first.user_id
user = User.first
end
has_many :pets
class User < ActiveRecord::Base
Raised when an attribute is not defined.