Geotargeting in rails app without storing data in model.

177 views Asked by At

In my rails app, how to i handle geolocation data for website visitors which aren't users in my model. For example yellowpages.com.au is able to detect my location and default this data into the search fields.

I'm currently using geocoder in my app to geocode post locations however these locations are determined by registered users in my database. From what i've gathered so far i need to geocode by IP but I'm not sure how to store the data without inputting it into a field in my model?

1

There are 1 answers

0
joshua.paling On

Yep, you'll need to do it by IP.

As for saving the data without saving it to your model / database, the obvious option would be to store it either in the session, or in a cookie. See http://www.tutorialspoint.com/ruby-on-rails/rails-session-cookies.htm