aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-28 00:32:36 -0800
committerJosé Valim <jose.valim@gmail.com>2011-12-28 00:32:36 -0800
commitd547761eb3f15ac223c56183c1e98254046e1a61 (patch)
tree848a60b1cb3f8d4a3da34205f7ae6a0fc09536cb /activerecord/lib/active_record
parentd7cfb636367f2f929d07ade9060d35a2cf7ad20b (diff)
parentb3490d82ba87219fbfc00c112184d9b6b06bc908 (diff)
downloadrails-d547761eb3f15ac223c56183c1e98254046e1a61.tar.gz
rails-d547761eb3f15ac223c56183c1e98254046e1a61.tar.bz2
rails-d547761eb3f15ac223c56183c1e98254046e1a61.zip
Merge pull request #4210 from tapajos/patch-1
Fix #4208
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index c281bead0d..26246510e6 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -63,10 +63,11 @@ module ActiveRecord
# => [#<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) }