Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add example to ActiveModel::MissingAttributeError [ci skip]

  • Loading branch information...
commit b8672914b746d3b29213a9b4b9252735f1c3ee5d 1 parent ac18d64
@frodsan frodsan authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 activemodel/lib/active_model/attribute_methods.rb
View
8 activemodel/lib/active_model/attribute_methods.rb
@@ -3,6 +3,14 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.