1.7.56. 用户丢弃 (向上)
<h2>User {{ user.display_name }}</h2>
Account {{ user.account.name }}
Username {{ user.username }}
Email {{ user.email }}
Website {{ user.website }}1.7.56.1. 方法
1.7.56.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ user.errors.name | inline_errors }}1.7.56.1.2. 管理员?
返回用户是否为 admin。
{% if user.admin? %}
<p>You are an admin of your account.</p>
{% endif %}1.7.56.1.3. username
返回用户的用户名 html escaped。
1.7.56.1.4. 帐户
返回用户的帐户。
1.7.56.1.5. name
返回用户的第一个和姓氏.
1.7.56.1.6. email
返回用户的电子邮件。
1.7.56.1.7. password_required?
对于通过 Janrain、CAS 或其他单点登录方法进行身份验证的用户 , 此方法将使用内置开发人员门户身份验证机制返回 真。
{% if user.password_required? %}
{% endif %}1.7.56.1.8. 部分
返回用户有权访问的部分列表。
{% if user.sections.size > 0 %}
<p>You can access following sections of our portal:</p>
<ul>
{% for section in user.sections %}
<li>{{ section }}</li>
{% endfor %}
</ul>
{% endif %}1.7.56.1.9. role
返回用户的角色
1.7.56.1.10. roles_collection
重新调整用户的可用角色列表
{% for role in user.roles_collection %}
<li>
<label for="user_role_{{ role.key }}">
{{ role.text }}
</label>
</li>
{% endfor %}1.7.56.1.11. url
返回用户的资源 URL
{{ 'Delete' | delete_button: user.url }}1.7.56.1.12. edit_url
返回 URL 以编辑用户
{{ 'Edit' | link_to: user.edit_url, title: 'Edit', class: 'action edit' }}1.7.56.1.13. can
授予权限方法访问权限
{% if user.can.be_managed? %}
<!-- do something -->
{% endif %}1.7.56.1.14. extra_fields
返回带有此用户 示例值的非隐藏额外字段:Pri nt all extra 字段
{% for field in user.extra_fields %}
{{ field.label }}: {{ field.value }}
{% endfor %}1.7.56.1.15. fields
返回所有包含此用户 示例值的字段:Pri nt all 字段
{% for field in user.fields %}
{{ field.label }}: {{ field.value }}
{% endfor %}1.7.56.1.16. builtin_fields
返回所有带有此用户值的内置字段