title: Custom authentication with foreign model in Rails 4 with Devise
body: <p>I have a typical <strong>User</strong> model (with username, email and password fields) that <strong>has_one Client</strong> model that <strong>has many</strong> Phone models.</p>
  
  <p>What I want to do is allow the user to sign in with a combination of either email + password, username + password or one of the phone numbers + password.</p>
  
  <p>How can I achieve this using Devise?</p>