Permalink
Browse files

[ci skip] correct select examples and doc, ref [522c0fd]

  • Loading branch information...
1 parent 544c78a commit 16f96238ba59fd81017b1402eb665e55c5dd4ba5 @kuldeepaggarwal kuldeepaggarwal committed Feb 28, 2014
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/relation/query_methods.rb
@@ -202,7 +202,7 @@ def references!(*table_names) # :nodoc:
# fields are retrieved:
#
# Model.select(:field)
- # # => [#<Model field:value>]
+ # # => [#<Model id: nil, field: "value">]
#
# Although in the above example it looks as though this method returns an
# array, it actually returns a relation object and can have other query
@@ -211,20 +211,20 @@ def references!(*table_names) # :nodoc:
# The argument to the method can also be an array of fields.
#
# Model.select(:field, :other_field, :and_one_more)
- # # => [#<Model field: "value", other_field: "value", and_one_more: "value">]
+ # # => [#<Model id: nil, field: "value", other_field: "value", and_one_more: "value">]
#
# You can also use one or more strings, which will be used unchanged as SELECT fields.
#
# Model.select('field AS field_one', 'other_field AS field_two')
- # # => [#<Model field: "value", other_field: "value">]
+ # # => [#<Model id: nil, field: "value", other_field: "value">]
#
# If an alias was specified, it will be accessible from the resulting objects:
#
# Model.select('field AS field_one').first.field_one
# # => "value"
#
# Accessing attributes of an object that do not have fields retrieved by a select
- # will throw <tt>ActiveModel::MissingAttributeError</tt>:
+ # except +id+ will throw <tt>ActiveModel::MissingAttributeError</tt>:
#
# Model.select(:field).first.other_field
# # => ActiveModel::MissingAttributeError: missing attribute: other_field

0 comments on commit 16f9623

Please sign in to comment.