简体   繁体   中英

Paginate method is not found on ActiveRecord::Relation with MetaSearch

I'm trying to paginate my search results from metasearch but I get a

undefined method `paginate' for #<ActiveRecord::Relation:0x6d3df28>

This is the code in my controller :

@search = Camping.search(params[:search])

if !params[:search].nil?
  @campings = @search.paginate(:page => params[:page])
else
  @campings = [];
end

This should be so simple I really don't see what's wrong...

I have those in my gem file :

gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'

所以是的,这很愚蠢,只是在安装了gem之后忘了重启服务器

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM