How to make a model for registering IPv4 and IPv6 IP addresses for quick search in Rails 3?

I am looking for a way to register IP addresses and user agents, and then request a list by IP address. I was hoping to keep the IP as efficient as possible, because the log might become very large over time. What type of data would I use for an IP address, string, long or decimal? and how can I index an IP column to speed up the Rails path?

Thanks!

+4
source share
1 answer

The most efficient way is to use the IPAddr class and then save them as integers in your database

+4
source

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


All Articles