Rails Kaminari pagination error with Ransack -


i using ransack kaminari - controller is:

def index    @q = household.search(params[:q])   @households = @q.result end 

the relevant part of view:

- @households.each |household|     %tr       %td= link_to household.household_name, edit_household_path(household)       %td= household.box       %td= household.thumbs.html_safe       %td= household.neighbors.count       %td= household.visits.count       %td= household.last_visit       %td         = link_to 'edit', edit_household_path(household), class: 'btn'         = link_to 'destroy', household, confirm: 'are sure?', method: :delete, class:    'btn btn-mini btn-danger'   = paginate @households 

this give me error:

undefined method `current_page' #<activerecord::relation:0x007fd4cd3a0b98> 

if change

= paginate @households 

to

= paginate households 

i ok pagination when execute search, when have blank don't pagination - using decent exposure allowing household instead of @household

change controller follows.

def index    @q = household.search(params[:q])   @households = @q.result.page(params[:page]).per(5) end 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -