consider here is array of records below
[#<IpAddress id: 26, ip: "12.10.20.11", latitude: '0.3155460609', longitude: '0.74357158' ,
#<IpAddress id: 27, ip: "12.10.20.12", latitude: '0.3155460609', longitude: '0.74357158',
#<IpAddress id: 29, ip: "12.10.20.30", latitude: '0.3155460609', longitude: '0.74357158',
#<IpAddress id: 44, ip: "127.0.0.1", latitude: '0.3155460609', longitude: '0.7435715',
#<IpAddress id: 52, ip: "127.0.0.3", latitude: '0.3155460609', longitude: '0.743571' ,
#<IpAddress id: 55, ip: "14.30.20.13", latitude: '0.3155460609', longitude: '0.74357']
I want to get ids of same ip's in this array by not considering last dot value of ip address in form of hash like below.
{12.10.20 => [26,27,29] , 127.0.0 => [44,52], 14.30.20 => [55]}
Any trick?
Thanks