diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-28 00:32:36 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-28 00:32:36 -0800 |
commit | d547761eb3f15ac223c56183c1e98254046e1a61 (patch) | |
tree | 848a60b1cb3f8d4a3da34205f7ae6a0fc09536cb /activerecord/lib | |
parent | d7cfb636367f2f929d07ade9060d35a2cf7ad20b (diff) | |
parent | b3490d82ba87219fbfc00c112184d9b6b06bc908 (diff) | |
download | rails-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')
-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) } |