Mark Jameson wrote: > It would be nice if this would work. I'm using GeoKit with named_scope > in Rails 2.1.
I got this working and it was really easy. Models with "acts_as_mappable" have a method for distance_sql(origin, units=default_units, formula=default_formula). I used this to create my condition. I am using anonymous scopes in a Search model which provides search for an Organization model, but a similar technique should work with named_scope. See this Railscast on creating a search with anonymous scopes: http://railscasts.com/episodes/112-anonymous-scopes I have "acts_as_mappable" on both my Search model and on my Organization model. This allows me to build a scope condition like this: scope = scope.conditions "#{Organization.distance_sql(self)} < #{self.distance}" Note that "self" is the search in this case. I hope this helps. BB -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---