rails/rails — pull request #9200 by wangjohn (2013-02-06 20:22:52+00:00)
Title: Adding unscope to WhereChain

This pull request adds functionality so that you can unscope something in a where chain. For instance, if you are passed in a WhereChain as follows: 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")

This is implemented for all methods in the ActiveRecord query interface such as:

where
select
group
order
reorder
reverse_order
limit
offset
joins
includes
lock
readonly
from
having

Currently, joins, includes, lock, readonly, from, and having have not yet been tested.