1.7.16. CurrentUser ドロップ (up)

1.7.16.1. メソッド

1.7.16.1.1. errors

送付に失敗した後にこのモデルのフォームがレンダリングされると、発生したエラーを返します。

{{ current_user.errors.name | inline_errors }}
1.7.16.1.2. admin?

ユーザーが管理者かどうかを返します。

{% if user.admin? %}
  <p>You are an admin of your account.</p>
{% endif %}
1.7.16.1.3. username

ユーザーのユーザー名を返します (html エスケープ)。

1.7.16.1.4. アカウント

ユーザーのアカウントを返します。

1.7.16.1.5. name

ユーザーの苗字および名前を返します。

1.7.16.1.6. email

ユーザーのメールアドレスを返します。

1.7.16.1.7. password_required?

このメソッドは、組み込みのデベロッパーポータルの認証メカニズムを使用するユーザーの場合は true を返し、Janrain、CAS、またはその他のシングルサインオンメソッドで認証されるユーザーの場合は false を返します。

{{ if user.password_required? }}


{{ endif }}
1.7.16.1.8. sections

ユーザーがアクセスすることのできるセクションのリストを返します。

{% 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.16.1.9. role

ユーザーのロールを返します。

1.7.16.1.10. roles_collection

ユーザーが利用可能なロールのリストを返します。

{% for role in user.roles_collection %}
  <li>
    <label for="user_role_{{ role.key }}">

      {{ role.text&nbsp;}}
    </label>
    </li>
  {% endfor %}
1.7.16.1.11. url

ユーザーのリソース URL を返します。

{{ 'Delete' | delete_button: user.url }}
1.7.16.1.12. edit_url

ユーザーを編集するための URL を返します。

{{ 'Edit' | link_to: user.edit_url, title: 'Edit', class: 'action edit' }}
1.7.16.1.13. can

現在のユーザーの権限 (設定およびユーザーのロールにより異なる) を公開します。返されたオブジェクトに対して以下のメソッドを呼び出すことができます。

  • invite_user?
  • create_application?
  • see_log_requests?
{% if current_user.can.see_log_requests? and application.log_requests? %}
   (<a href="{{ application.log_requests_url }}" class="action edit">App Request Log</a>)
{% endif %}
1.7.16.1.14. extra_fields

このユーザーの非表示ではない追加フィールドを値と共に返します (例: すべての追加フィールドを表示する)。

{% for field in user.extra_fields %}
  {{ field.label }}: {{ field.value }}
{% endfor %}
1.7.16.1.15. fields

このユーザーのすべてのフィールドを値と共に返します (例: すべてのフィールドを表示する)。

{% for field in user.fields %}
  {{ field.label }}: {{ field.value }}
{% endfor %}
1.7.16.1.16. builtin_fields

このユーザーのすべての組み込みフィールドを値と共に返します。