I am using Rails 2.2.2,
trying to get hostname by IP with code like
require 'socket'
Socket.getaddrinfo('221.186.184.68', nil, "AF_INET")
In the rails console it works well and gives me:
[["AF_INET", 0, "carbon.ruby-lang.org", "221.186.184.68", 2, 2, 17],
["AF_INET", 0, "carbon.ruby-lang.org", "221.186.184.68", 2, 1, 6]]
But, inside model or controller output different:
[["AF_INET", 0, "221.186.184.68", "221.186.184.68", 2, 2, 17],
["AF_INET", 0, "221.186.184.68", "221.186.184.68", 2, 1, 6]]
Please help to fix and get hostname by ip inside model.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---