mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
add example to ActiveModel::MissingAttributeError [ci skip]
This commit is contained in:
parent
ac18d642e9
commit
b8672914b7
1 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,14 @@ require 'active_support/deprecation'
|
|||
|
||||
module ActiveModel
|
||||
# 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
|
||||
class MissingAttributeError < NoMethodError
|
||||
end
|
||||
# == Active Model Attribute Methods
|
||||
|
|
Loading…
Reference in a new issue