Permalink
Browse files

add example to ActiveModel::MissingAttributeError [ci skip]

  • Loading branch information...
1 parent ac18d64 commit b8672914b746d3b29213a9b4b9252735f1c3ee5d Francesco Rodriguez committed Jul 28, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 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

0 comments on commit b867291

Please sign in to comment.