Problem z will_paginate i pg_search w RoR 4
pg_search i will_paginate — mają problem ze wzajemną współpracą pod Ruby on Rails 4 w gałęzi 4-0-stable. Problemem jest sposób wywołania metody count przez will_paginate. Poprawka jest prosta — samodzielnie definiujemy total_entries dla metody paginate. Przykład:
@posts = Post.search(params[:search])
@posts_counter = @entries.count(:all)
@posts = @posts.paginate(page: params[:page], per_page: 10, total_entries: @posts_counter)