sample for login logic for rails