I'm looking for a way to log IP addresses and user agents and then query against the list by IP. I was hoping to store the IP as efficiently as possible because the log could grow to be very large over time. What data 开发者_运维知识库type would I use for the IP address, string, long, or decimal? and how do I index the IP column for speed the Rails way?
Thanks!
Most efficient way is to use the IPAddr class, and then store them in your database as integers
精彩评论