Rails-Based Address Routing in Rails

I am new to rails. I want to learn more about IP-based location routing GeoLocation URLs.

I have 2 questions.

The first...

Depending on the location of the country, how do you have URL routing?

If my IP address is from the USA, I should be directed to the main page in the USA.

If I am from the UK, I must be directed from the UK homepage.

If I am from any other country, I should be directed to the main page on the Internet.

Could you help me with rails code? Could you help me with a good tutorial?

and now the second question ....

How to use GeoLocation to route people to their cities?

Let's say that I access the network from Los Angeles, I should be directed to the home page of Los Angeles.

If I get network access in a small town, I should be directed to the nearest city page.

If I am internationally [outside the US they say], then I should be directed to the international page

Awaiting your help

Gautam

+3
source share
1 answer

To estimate a location based on an IP request, you should look at Geokit .

, , , . URL- .

class ApplicationController < ActionController::Base
  geocode_ip_address
end

, GeoKit , - session [: geo_location] .

, !

+4

Source: https://habr.com/ru/post/1748496/


All Articles