will_paginate をインストールした後、正常に動作する sphinx サーバーである Rails 3.2.13 を使用しています。gem のページネーションが機能しません。
エラーは次のとおりです。
NoMethodError in DashboardsController#search
undefined method `paginate' for #<ThinkingSphinx::Search:0x000000046a9650>
app/controllers/dashboards_controller.rb:12:in `search'
これは私の Dashboard Cotroller のコードです
class DashboardsController < ApplicationController
def search
query=[]
query << "#{params[:property_listing]}" if(params[:property_listing]).present?
query << "#{params[:property_type]}" if(params[:property_type]).present?
query << "#{params[:city]}" if(params[:city]).present?
query << "#{params[:sale_price]}" if(params[:sale_price]).present?
@properties = Property.search("*#{query}*").paginate(:page=>params[:page], :per_page=>5)
@json = @properties.to_gmaps4rails
respond_to do |format|
format.html
end
end
end
search.html.erb
<% @properties.each do |property| %>
//some codes which is working fine before using pagination
<% end %>
<%= will_paginate(@properties) %>
gemをインストールしました
gem 'will_paginate','>= 3.0.pre'
結果が表示されません。