Permalink
Browse files

Merge pull request #4210 from tapajos/patch-1

Fix #4208
  • Loading branch information...
josevalim committed Dec 28, 2011
2 parents d7cfb63 + b3490d8 commit d547761eb3f15ac223c56183c1e98254046e1a61
Showing with 3 additions and 2 deletions.
  1. +3 −2 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 d547761

Please sign in to comment.