I'm creating a simple Rails application with Sign Up, Log In and Log out functionality using has_secure_password and bcrypt gem.
I then want to display profiles of this user and other users. What is the best way to implement it?
I have two ways in my mind.
Which of these two methods is the best, and will later work better with caching and scalability etc.
Thank You!
Rajkumar
Fullstack Developer.
Having authentication mechanism away from user details is the best way. Reason is, we don't carry unwanted data when user just requested to view his profile.
But based on your question, if the authentication model is going to have only email & username, then I suggest to have it in User model itself. But if it contains authentication data like token, login_status etc, it will be clean and better to have Auth & User model separately.