提交 96050e1d 编写于 作者: C Carlos Antonio da Silva

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

上级 8d69cd3e
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册