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?

paginationとrequest referer

Last updated at Posted at 2025-11-05

<%= paginate @users %>
データが大量にあると長くなって読みにくいから、ページを分割して見やすくしてくれる。
なおかつページをめくるボタンを作成してくれる

redirect_to request referer
→request refererで一つ前のページという意味になる
したがって、一つ前のページに戻るといった指示になる

<% if @post.user == current_user %>
@postが今表示されている投稿、投稿には当然「誰が作ったのか?」の情報がくっついているよね!
@post.userで投稿を作った人の名前
current=userが今ログインしている人の名前
→今表示されている投稿を作った人の名前が今ログインしている人の名前と同じかどうか
と条件設定しているわけだ

0
0
2

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?