Iam using geokit-rails (http://github.com/jlecour/geokit-rails branch gem). I like to build a scope like
a = MyModel.scoped
a = a.limit(10).scoped
a = a.find_within(10,:origin => [mylat,mylng]).scoped
a = a.where(:visible => true)
a = a.pag开发者_JAVA技巧inate(:page => @params[:page], :per_page => 20)
But this does't work - after find the query will fired. The scopes .origin and .within (described in the documentation of geokit-rails) don't work.
In rails2 I'd used rayn bates scope_builder and this do work until the update on rails3. Cause I'm not such a advanced programmer I'm not able do implement my own scope into geokit-rails.
Does anyone have a idea how i prevent ActiveRecord to fire the query on the find_within method? Thanks
Ok the solution is here: http://github.com/Olli/geokit-rails/commit/7df7316870045def9eaaf640d4a068853c8d1962 Have Fun :)
精彩评论