activerecord-hackery/meta_search

All records loaded by default

Closed this issue · 1 comments

pch commented

I've run into an issue with the last version of meta_search. Controller:

@search = Website.search(params[:search]) # Search params are empty

This results in:

SELECT `websites`.* FROM `websites`

When I add some chaining to the controller code:

@search = Website.search(params[:search])
@websites = @search.paginate(:page => params[:page], :per_page => params[:per_page] || 10)

2 queries are executed:

SELECT `websites`.* FROM `websites` LIMIT 10 OFFSET 0
SELECT `websites`.* FROM `websites` 

Shouldn't it use lazy loading and execute just 1 query?

pch commented

Forget it, my bad. For some reason rails_footnotes is causing this.