Refactor model condition to Rails 4