Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Zero-effort creation of Location-aware Rails application based on W3C Geolocaton API.
Ruby
branch: master

README.markdown

GeoMereLaal

(जियो मेरे लाल : ji-oo-me-re-laal : "Keep it up baby!")

GeoMereLaal plugin is all you need to create Location-Aware rails application based on W3C Geolocaton API.

Quick Audio Intro: Thanks to Ruby5 Podcast

What's Location-Awareness?

W3C proposed an API in which internet browsers can have capability to retrieve geo-location of the user via multiple sources (Wifi, LBS, IP, browser cookies) and share it with web apps so that apps can serve content based on user's location.

Who supports it?

Web Browser Geolocation API support
Mozilla Firefox supported in Firefox 3.5 and later versions.
Chrome Supports thru Google Gears Geolocation API
Opera Supported in nightly builds – download from this page
Safari Support is coming soon in the IPhone’s Safari browser.
Internet Explorer An experimental support available from IE8.

How do I use it?

Step 1 : Install

 script/plugin install git://github.com/parolkar/geo_mere_laal.git 

Step 2 : Create form (as you always did but with new helpers)

Note: You may want to generate Address model this way script/generate model Address street:string locality:string city:string state:string country:string zip:string lat:string lng:string

   

<% form_tag('#') do  -%>
   <%= label :address,"street","Street" -%>
   <%= street_field :address, "street" %>    
    
   <%= label :address,"locality","Locality" -%>
   <%= locality_field :address, "locality" %>  

   <%= label :address,"city","City" -%>
   <%= city_field :address, "city" %>  

   <%= label :address,"state","State" -%> 
   <%= state_field :address, "state" %>      

   <%= label :address,"country","Country Name" -%>
   <%= country_name_field :address, "country" %>

   <%= label :address,"zip","Postal Code" -%>
   <%= postal_code_field :address, "zip" %>
    
<% end %>

Step 3: ...... there is no step 3 ;-)

The rendered form will auto fill the content with user's geolocation

Output

Copyright (c) 2009 Abhishek Parolkar, released under the MIT license

Something went wrong with that request. Please try again.