Tomoko Yamaguchi
Tomoko Yamaguchi

Reputation: 497

create a profile page for user to view as if logged out

I'm making a Rails application using Devise. On the user profile page, it provides links for the user to update and delete certain elements of their profile. The links are obviously only visible to the signed-in user whose profile it is. The one disadvantage of this is that it doesn't allow the user to view their profile page from the perspective of a visitor, unless they want to log out and navigate to their profile. Some websites offer a "view your profile" link which allows users to view a page from the perspective of someone else. Is there a way to accomplish this with Rails and Devise?

Upvotes: 0

Views: 184

Answers (1)

ck3g
ck3g

Reputation: 5929

Sure. You are able to create UsersController with show action. Where you will able to display the information you want.

If you want to manage users through CRUD interface there is a wiki page that may help you.

The url to user's profile can looks like /users/:id or you can define custom route such as /user/unique-username (the last example you can achieve using friendly_id gem)

Upvotes: 0

Related Questions