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 3 years have passed since last update.

【Rails】Kaminariで、ページネーションを解除する方法

Posted at

結論

ページネーションしているインスタンスに、以下の記述を追加する。

.except(:limit, :offset)

もう少し詳しく

# 全件取得
@users = User.all

# 全部で100件
@users.count # => 100



# 30件ごとにページネーションして、1ページ目を取得
@users = @users.page(1).per(30)

# 全部で30件
@users.count # => 30



# ページネーションを解除
@users.except(:limit, :offset)

# 全部で100件
@users.count # => 100
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?