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:in `initialize'' 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:in `initialize'' 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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 On Jan 26, 5:47 pm, Pete Campbell <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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:in > `initialize'' > 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:in > `initialize'' > 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 > > -- > Posted viahttp://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pete Campbell
2011-Feb-10 20:37 UTC
Solved! Re: GeoIP gem working locally but not on server
Bingo! Thanks Edmond, you are exactly correct. I appreciate your help. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.