rails/rails — pull request #12849 by xuanxu (2013-11-11 14:16:39+00:00)
Title: New method ActiveRecord::QueryMethods#unwhere

ActiveRecord::QueryMethods#**unwhere** unscopes selectively existing, named where conditions.

```ruby
Post.where(author: 'X', trashed: true).unwhere(:trashed) #=> WHERE `author` = 'X'
Post.where(trashed: false).unwhere(:trashed) #=> Post.all
Post.where(active: true).where(trashed: true).unwhere #=> Post.all
```

`unwhere` complements `rewhere`, and it's also a short-hand for a common feature.