I have recently discovered the brilliant has_finder. It allows you to
name your ActiveRecord searches,
and stack them together. It fulfills a similar need to scope_out.
One of my searches is location based, using the excellent plugin
Geokit.
http://geokit.rubyforge.org/. Normally I can do a spatial search like
so:
MyModel.find(:all, :origin => [lat, lng], :within => miles_in_int)
When I try to do this within a has_finder finder (see below), it
complains
:origin and :within can not be find. It must be accessing the finder
methods
directly without going through Geokit.
has_finder :proximity, lambda {|lat, lon| { :origin => [lat,
lon], :within
=> 100 } }
normal has_finder
has_finder :of_type, lambda {|type_id| { :conditions =>
{:feature_type_id =>
type_id} } }
I am not sure how it all works under the hood. Can anyone advice on
getting this to work? Any pointers would really help.
I’ll take a look at the source code in the mean time.
Thanks,
Xin