Devise显示用户页面 [英] Devise show user page

查看:156
本文介绍了Devise显示用户页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个允许用户查看他们的个人资料的页面。

How would I create a page that allows the user to view their profile.

任何人围绕/看/知道一个答案这个问题?我将非常感激。

Anyone worked around/see/know an answer this problem? I would greatly appreciate it.

推荐答案

这不是一个简单的路由问题的设计问题:

This is not so much a devise problem as a simple routing issue:

只需创建一个 ProfileController 和一个动作显示,然后执行以下操作您的 routes.rb

Just create a ProfileController and an action Show and then do the following in your routes.rb:

match '/profile', :to => "profile#show"

您的个人资料#show action:

Inside your profile#show action:

def show
  @profile = current_user
end

,并在视图中显示有关存储在@profile中的用户的信息。

and in the view you display the information about the user that is stored in @profile.

这篇关于Devise显示用户页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆