activerecord-hackery / meta_search

Object-based searching (and more) for simply creating search forms. Not currently maintained.
http://erniemiller.org/2013/11/17/anyone-interested-in-activerecord-hackery/
MIT License
903 stars 140 forks source link

All records loaded by default #82

Closed pch closed 12 years ago

pch commented 12 years ago

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 12 years ago

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