Newbie learning ruby on rails question


I have designed a simple sign up, log-in and sign out system linked to a
mysql database which is all working well.

My next challenge is for each user to have a sub domain like or once they have signed up.
Also when the user has logged in they should be redirected to a admin
page for his sub domain.

I’m confused at the best way to proceed.