Using User.any? instead of User.all.any?

In this case it is not necessary ( and will perform worst ) to use .all on User. You can just call User.any? and your execution should be significantly faster.