Exception: ActiveModel::MissingAttributeError

Inherits:
NoMethodError
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/attribute_methods.rb

Overview

Raised when an attribute is not defined.

class User < ActiveRecord::Base
  has_many :pets
end

user = User.first
user.pets.select(:id).first.user_id
# => ActiveModel::MissingAttributeError: missing attribute: user_id