diff options
author | Marcos Tapajós <tapajos@gmail.com> | 2011-12-27 20:31:29 -0200 |
---|---|---|
committer | Marcos Tapajós <tapajos@gmail.com> | 2011-12-27 20:31:29 -0200 |
commit | b3490d82ba87219fbfc00c112184d9b6b06bc908 (patch) | |
tree | 848a60b1cb3f8d4a3da34205f7ae6a0fc09536cb | |
parent | d7cfb636367f2f929d07ade9060d35a2cf7ad20b (diff) | |
download | rails-b3490d82ba87219fbfc00c112184d9b6b06bc908.tar.gz rails-b3490d82ba87219fbfc00c112184d9b6b06bc908.tar.bz2 rails-b3490d82ba87219fbfc00c112184d9b6b06bc908.zip |
Closes #4208
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 5 |
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) } |