ActsAsLocateable released 9

Posted by Jeff Sat, 30 Dec 2006 01:54:00 GMT

Introducing my 2nd adventure into Rails plugins: ActsAsLocateable!

ActsAsLocateable is an easy way to give any model the ability to be found by location. For instance, say you have a model Store which is associated with a zip code indicating where that Store is located. To find all the stores within a specific radius of another ZipCode, you can do a

Store.find_within_radius(10, 12345)     # Find all stores within 10 miles of zip code 12345

Install ActsAsLocateable in the normal way

script/plugin install http://svn.baconbear.com/rails_plugins/acts_as_locateable/trunk/

Be sure to read the associated README file after the install for details on installation, setup, and usage.

ActsAsLocateable is based heavily on the ZipCodeSearch plugin by Doug Fales and utilizes much of the same code and data. Special thanks to Doug for making his code freely available!

Comments

Leave a response

  1. Joshua Warchol Thu, 04 Jan 2007 22:15:13 GMT
    Neat plugin. Couple of questions. Why are latitude and longitude stored in the DB as strings as opposed to floats? I redid the migration with floats and it seems to work well. I also added an index to speed things up. add_index :zip_codes, [:latitude, :longitude] And to help folks using MySQL, here's the faster load syntax: LOAD DATA INFILE '[your filename]' INTO TABLE zip_codes FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' (zip, latitude, longitude, city, state, zip_class);
  2. Jeff Lee Fri, 05 Jan 2007 01:32:17 GMT
    Good suggestions. I originally didn't make those changes simply because that's the way ZipCodeSearch did things. I'll make the changes and post an update when I get a chance.
  3. James Stewart Wed, 07 Feb 2007 21:06:39 GMT
    It would be nice to be able to pass in standard AR conditions and have them applied to the query too. That way I could, say, search for all events within a given radius and on a certain day. I've patched my copy and can email a diff if you'd like. Pasting it in here seems to lose all the formatting.
  4. James Stewart Wed, 07 Feb 2007 21:17:45 GMT
    I've actually posted the patch over on my blog. You can find it at: http://jystewart.net/process/archives/2007/02/extending-acts_as_locateable/
  5. casino di internet Tue, 04 Dec 2007 11:38:14 GMT
    Qui vi insegniamo a giocare ai migliori giochi del casinò di internet per meglio vincere un sacco di soldi.
  6. punenet.com Sun, 16 Dec 2007 09:29:43 GMT
    Auf punenet.com können Sie alle Spielregeln für das Spielen im Online Casino nachlesen!
  7. Casino Wed, 26 Dec 2007 01:52:33 GMT
    Das Casinoland entführt Sie in die Welt der Online Casinos und zeigt Ihnen, wo Sie sicher spielen können.
  8. backgammon games Tue, 08 Jan 2008 09:07:55 GMT
    Backgammon online is easy to play and enjoyable, check out our backgammon guide to find out how and where to play.
  9. casinos Fri, 25 Jan 2008 13:12:32 GMT
    Hey, thanks for sharing this information. I see that I am not the only one with problems in this field.
Comments