states = [ 'CA', 'TX', 'LA' ] find(:all, :origin => @somewhere, :within => 5, :conditions=>['state IN ( ? )',states])
- Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Fri, Feb 20, 2009 at 4:58 PM, Naija Guy <[email protected]> wrote: > > http://geokit.rubyforge.org/readme.html > > While browsing the above page, I looked at this query and wondered if it > could be changed to include multiple possible values for state: > > find(:all, :origin => @somewhere, :within => 5, > :conditions=>['state=?',state]) > > > How would I tell ActiveRecord to return any records where state was 'CA' > or 'TX' or 'NY'? It seems like it'd be more efficient to go ahead and > constrain the results from the beginning... > > Thanks! > -- > 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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---

