Sql query with pagination

I am Using will_paginate plugin in a call like :

@homes = Home.paginate(:all, :conditions => conditions…

I want to have minimum and maximum price within all @homes searched. How
would I do that efficiently?
Since I do pagination, the @homes variable doesn’t contain all the
“homes” objects, but only partial ones for pagination. Do I have to do
another query with same conditions without pagination to get it?

use named scopes, read a bit about them, lets you chain them like this
Home.ranged(6…9).paginate( etc etc)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs