0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【rails】登録日の表示について

Posted at

はじめに

今回はdeviseというgemを使った環境だったのでcreated_at(登録日)というカラムが最初から入っていました。
なのでそれを使います。

結論

index.html.erb
<span class="scoreStatus_list_label registration_date">
   登録日
  <%= current_user.created_at.strftime('%Y/%m/%d') %>
</span>

こちらのコードを表示させると

スクリーンショット 2022-02-26 21.26.26.png

こうなります!

注意点

ログイン(新規登録)してからじゃないと、current_userがエラーを起こしますのでご注意を!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?