Skip to content
Browse files

Closes #4208

  • Loading branch information...
1 parent d7cfb63 commit b3490d82ba87219fbfc00c112184d9b6b06bc908 @tapajos tapajos committed
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/lib/active_record/relation/query_methods.rb
View
5 activerecord/lib/active_record/relation/query_methods.rb
@@ -63,10 +63,11 @@ def preload(*args)
# => [#<Model field: "value", other_field: "value", and_one_more: "value">]
#
# Any attributes that do not have fields retrieved by a select
- # will return `nil` when the getter method for that attribute is used:
+ # will raise a ActiveModel::MissingAttributeError when the getter method for that attribute is used:
#
# >> Model.select(:field).first.other_field
- # => nil
+ # => ActiveModel::MissingAttributeError: missing attribute: other_field
+
def select(value = Proc.new)
if block_given?
to_a.select {|*block_args| value.call(*block_args) }

0 comments on commit b3490d8

Please sign in to comment.
Something went wrong with that request. Please try again.