I’m working on a site where every user has a profile that everyone else can see.
i.e.
http://localhost:3000/trista
Right now i stupidly pull in all the data in the view using current_user.name etc.
Sorry, this is probably really simple but how do I add the user info for “trista” and not me, the current_user?
Thanks for your help!
Well, it seems that you have a
Usermodel. And the action you are requesting is theshowon on yourusers_controller.This way i believe you have something similar to this:
The thing is, you load the
@userinstance variable so you can use it in your views like this:Using
current_userwill get the logged one. Using@user, you can populate it anyway you want in your controller. Hope it gives you some enlightment.