aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-19 09:37:01 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-19 09:38:19 -0200
commit0d65969e6869f01bf6f459add3635497ed630156 (patch)
treec981467a77efc1dcf485cb3ebc93f732cff4a9c4
parentf209b176c3a39af11f25e7a77fd856b5ad55c996 (diff)
downloadrails-0d65969e6869f01bf6f459add3635497ed630156.tar.gz
rails-0d65969e6869f01bf6f459add3635497ed630156.tar.bz2
rails-0d65969e6869f01bf6f459add3635497ed630156.zip
Improve relation docs about to_sql and where_values_hash
* User class instead of Users. * #where_values_hash does not change the value to downcase as the example was showing. [ci skip]
-rw-r--r--activerecord/lib/active_record/relation.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index 0718c5076e..0053530f73 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -474,16 +474,16 @@ module ActiveRecord
# Returns sql statement for the relation.
#
- # Users.where(name: 'Oscar').to_sql
+ # User.where(name: 'Oscar').to_sql
# # => SELECT "users".* FROM "users" WHERE "users"."name" = 'Oscar'
def to_sql
@to_sql ||= klass.connection.to_sql(arel, bind_values.dup)
end
- # Returns a hash of where conditions
+ # Returns a hash of where conditions.
#
- # Users.where(name: 'Oscar').where_values_hash
- # # => {name: "oscar"}
+ # User.where(name: 'Oscar').where_values_hash
+ # # => {name: "Oscar"}
def where_values_hash
equalities = with_default_scope.where_values.grep(Arel::Nodes::Equality).find_all { |node|
node.left.relation.name == table_name