I am using a simple search that displays search results:
@adds = Add.search(params[:search])
In addition to the search results I'm trying to utilize a method, nearbys(), which displays objects that are close in proximity to the search result. The following method displays objects which are close to 2, but it does not display object 2. How do I display object 2 in conjunction with the nearby objects?
@adds = Add.find(2).nearbys(10)
While the above code functions, when I use search, @adds = Add.search(params[:search]).nearbys(10)
a no method error is returned, undefined method
nearbys' for Array:0x30c3278`
How can I search the model for an object AND use the nearbys() method AND display all results returned?
Model:
def self.search(search)
if search
find(:all, :conditions => ['address LIKE ?', "%#{search}%"])
# where('address LIKE ?', "%#{search}")
else
find(:all)
end
end