Redmine中的用户名 [英] User name in Redmine

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

问题描述

我想获取当前用户的姓名.正如文档所描述的,我应该使用 User.name 方法.尝试像示例中那样使用它 - 没有用.试过这个:

I want to get current user's name. As documentation describes, I should user User.name method. Tried to use it as in the example - didn't work. Tried this:

val = User.current.name

还有这个:

user = User.find(User.current.id)
val = user.name


我做错了什么?


What am I doing wrong?

推荐答案

除非您对 Redmine 实例做了一些奇怪的事情,否则您应该始终拥有一个 User.current.所以你应该也可以使用 User.current.name.

Unless you do something strange with your Redmine instance, you should always have a User.current. So you should also be able to use User.current.name.

由于这不起作用,正如您所说,您能否详细说明一下究竟不起作用的地方?

As this did not work, as you said, could you please elaborate a bit on what exactly didn't work?

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

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