GeoIP gem working locally but not on server

I have the GeoIP gem working in my local environment (OSX), but when I
move the code to our dev server (Ubuntu) via scp then it doesn’t work -
it
looks like the file is being treated like a text file instead of binary:

g = GeoIP.new("#{RAILS_ROOT}/lib/GeoIP.dat")
NoMethodError: undefined method bytes' for "ved":String from /var/www/apps/buwebsite/releases/20110126214815/vendor/gems/geoip-0.8.9/lib/geoip.rb:672:ininitialize’
from
/var/www/apps/buwebsite/releases/20110126214815/vendor/gems/geoip-0.8.9/lib/geoip.rb:671:in
upto' from /var/www/apps/buwebsite/releases/20110126214815/vendor/gems/geoip-0.8.9/lib/geoip.rb:671:ininitialize’
from (irb):1:in `new’
from (irb):1

Any thoughts? I’m now considering a MySQL based approach which seems
like it has less potential for problems:
http://ipinfodb.com/ip_database.php

Thanks

Pete

It has to do with the ruby version.

In Ruby 1.8.6, the String class does not have the method bytes. But in
Ruby 1.8.7 the String class does.

So I bet you have 1.8.6 on your Ubuntu and 1.8.7 on your OSX.

Thanks,
Edmond

Bingo! Thanks Edmond, you are exactly correct. I appreciate your help.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs