rails/rails — pull request #12264 by inossidabile (2013-09-17 19:10:45+00:00)
Title: Relation merge made to always return clone

The `merge` method of `Relation` is expected to return a copy of relation as opposed to `merge!`. However if you pass a `nil` or `false` into, it returns `self` which is a very tricky violation of interface. As the result you may appear in the situation where you accidentally modify a scope that you expected to save untouched.

This tiny fix makes it return a copy no matter what arguments you pass.