aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/query_methods.rb
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-01-19 21:41:50 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-01-19 21:53:37 +0530
commite95e932fbe38617b72f21fde6cac53f49473d881 (patch)
tree3507e4eb4201009854c88fa7004954a61fe1f233 /activerecord/lib/active_record/relation/query_methods.rb
parent5caf1bd2148825404166254f676a7d4e4615cdc7 (diff)
downloadrails-e95e932fbe38617b72f21fde6cac53f49473d881.tar.gz
rails-e95e932fbe38617b72f21fde6cac53f49473d881.tar.bz2
rails-e95e932fbe38617b72f21fde6cac53f49473d881.zip
select doesn't take multiple arguments - fixes #4539 [ci skip]
Also, fixed the bit about returning AM::MissingAttributeError. This seems to be fixed earlier in 3-2-stable only.
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index b5f202ef6a..a8ae7208fc 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -75,16 +75,16 @@ module ActiveRecord
# array, it actually returns a relation object and can have other query
# methods appended to it, such as the other methods in ActiveRecord::QueryMethods.
#
- # This method will also take multiple parameters:
+ # The argument to the method can also be an array of fields.
#
- # >> Model.select(:field, :other_field, :and_one_more)
+ # >> Model.select([:field, :other_field, :and_one_more])
# => [#<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:
+ # Accessing attributes of an object that do not have fields retrieved by a select
+ # will throw <tt>ActiveModel::MissingAttributeError</tt>:
#
# >> 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) }