Fix filter sometimes missing a condition in Rails 3.1 and 3.2