Permalink
Browse files

Use 1.9 hash style in changelog and doc examples [ci skip]

  • Loading branch information...
1 parent 8d69cd3 commit 96050e1d73ff97b52f3ef3b79f813b75df615833 @carlosantoniodasilva carlosantoniodasilva committed Mar 4, 2013
Showing with 6 additions and 6 deletions.
  1. +3 −3 activerecord/CHANGELOG.md
  2. +3 −3 activerecord/lib/active_record/relation/query_methods.rb
@@ -3,12 +3,12 @@
* Added functionality to unscope relations in a relations chain. For
instance, if you are passed in a chain of relations as follows:
- Posts.select(:name => "John").order('id DESC')
+ Posts.select(name: "John").order('id DESC')
but you want to get rid of order, then this feature allows you to do:
- Posts.select(:name => "John").order("id DESC").unscope(:order)
- == Posts.select(:name => "John")
+ Posts.select(name: "John").order("id DESC").unscope(:order)
+ == Posts.select(name: "John")
The .unscope() function is more general than the .except() method because
.except() only works on the relation it is acting on. However, .unscope()
@@ -331,15 +331,15 @@ def reorder!(*args) # :nodoc:
# which should be unscoped. The valid arguments are given in VALID_UNSCOPING_VALUES.
# The method can also be called with multiple arguments. For example:
#
- # User.all.order('email DESC').select('id').where(:name => "John")
+ # User.all.order('email DESC').select('id').where(name: "John")
# .unscope(:order, :select, :where) == User.all
#
# One can additionally pass a hash as an argument to unscope specific :where values.
# This is done by passing a hash with a single key-value pair. The key should be
# :where and the value should be the where value to unscope. For example:
#
- # User.all.where(:name => "John", :active => true).unscope(:where => :name)
- # == User.all.where(:active => true)
+ # User.all.where(name: "John", active: true).unscope(where: :name)
+ # == User.all.where(active: true)
#
# Note that this method is more generalized than ActiveRecord::SpawnMethods#except
# because #except will only affect a particular relation's values. It won't wipe

0 comments on commit 96050e1

Please sign in to comment.