Ransack宝石和无尽的滚动

时间:2014-06-09 18:23:32

标签: ruby-on-rails ruby-on-rails-4 ransack

  @q = @integration.profiles.search(params[:q])
  @profiles = @q.result.where(found: true).select("profiles.*").group("profiles.id, profiles.email").includes(:integration_profiles).order("CAST( translate(meta_data -> '#{params[:sort_by]}', ',', '') AS INT) DESC NULLS LAST").page(params[:page]).per_page(20)

当没有搜索时......在进行搜索时,这非常有效:

http://127.0.0.1:3000/integrations/64?utf8=%E2%9C%93&q%5Bbio_or_topics_or_title_or_company_cont_any%5D=&q%5Btitle_cont%5D=&q%5Bcompany_cont%5D=&q%5Blocation_cont_any%5D=toronto&sort_by=twitter_followers&q%5Bfacebook_username_not_eq%5D=&q%5Btwitter_username_not_eq%5D=&q%5Blinkedin_username_not_eq%5D=&q%5Blocation_not_eq%5D=&commit=Search

但无休止的滚动打破了:

http://127.0.0.1:3000/integrations/64?commit=Search&page=3&q%5Blocation_cont_any%5D%5B%5D=toronto&sort_by=twitter_followers&utf8=%E2%9C%93&_=1402337761650

$('.append-me').append( '<div class=\"row profile-list\">\n        <\/div>' );

profileBind();
    $('.pagination').remove();

由于将&q%5Blocation_cont_any%5D=toronto编码为&q%5Blocation_cont_any%5D%5B%5D=toronto

,会发生这种情况

应该提到我使用Will_Paginate宝石作为我的分页<%= will_paginate @profiles, renderer: BootstrapPagination::Rails, class: 'pagination pagination-sm' %>

0 个答案:

没有答案