-1

I only want to show posts starting with the second newest so am using 'offset(1)' in the controller (which i've used before with success) but it's not working since I need 'page(params[:page]).per_page(1)' at the end.

This does not offset:

@posts = Post.top.hide.offset(1).page(params[:page]).per_page(1)

This offsets but messes up the pagination:

@posts = Post.top.hide.page(params[:page]).per_page(1).offset(1)

I also tried putting it in the 'top' scope with the same results as above:

scope :top, (select('...').offset(1))
user2759575
  • 553
  • 3
  • 25
  • I recommend using the rails console to practice the queries and view the sql generated. The #page method from will_paginate uses its own offset and it looks like whichever is called last will gain priority. – Steve Sep 26 '14 at 01:01

1 Answers1

-1

Which library do you use for pagination? Which Rails version do you use?

If kaminari, you can try using the method "padding"

see also this question: How can I set initial offset for first page in kaminari?

Community
  • 1
  • 1
R11 Runner
  • 81
  • 3