Lookup user id from username or email address

What I was looking for turned out to be this:

User.find_by_username(username)&.id