123456789_123456789_123456789_123456789_123456789_

Exception: ActiveModel::MissingAttributeError

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, NoMethodError
Instance Chain:
self, NoMethodError
Inherits: NoMethodError
  • ::Object
Defined in: activemodel/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' for Pet