diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-07-28 01:19:38 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-07-28 01:19:38 -0500 |
commit | b8672914b746d3b29213a9b4b9252735f1c3ee5d (patch) | |
tree | 08c9e729a3d643c4d9f886bd5e955a746214b06d | |
parent | ac18d642e9282fad0c2ba8f16d3c9627b507b40f (diff) | |
download | rails-b8672914b746d3b29213a9b4b9252735f1c3ee5d.tar.gz rails-b8672914b746d3b29213a9b4b9252735f1c3ee5d.tar.bz2 rails-b8672914b746d3b29213a9b4b9252735f1c3ee5d.zip |
add example to ActiveModel::MissingAttributeError [ci skip]
-rw-r--r-- | activemodel/lib/active_model/attribute_methods.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index eb06250060..b1bef4b1e1 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -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 |