Permalink
Browse files

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]
  • Loading branch information...
1 parent f209b17 commit 0d65969e6869f01bf6f459add3635497ed630156 @carlosantoniodasilva carlosantoniodasilva committed Jan 19, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/relation.rb
@@ -474,16 +474,16 @@ def reset
# 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

0 comments on commit 0d65969

Please sign in to comment.