Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant GeoIP #13

Closed
vitobotta opened this issue Jun 8, 2011 · 5 comments
Closed

uninitialized constant GeoIP #13

vitobotta opened this issue Jun 8, 2011 · 5 comments

Comments

@vitobotta
Copy link

Hi, I am trying to use this gem in an app, but for some reason the GeoIP class cannot be found:

ree-1.8.7-2011.03 :001 > require 'geoip'
=> true
ree-1.8.7-2011.03 :002 > GeoIP
NameError: uninitialized constant GeoIP
from (irb):2

Am I missing something?

Many thanks in advance
Vito

@cjheath
Copy link
Owner

cjheath commented Jun 8, 2011

On 08/06/2011, at 10:04 PM, vitobotta wrote:

Hi, I am trying to use this gem in an app, but for some reason the
GeoIP class cannot be found:
ree-1.8.7-2011.03 :001 > require 'geoip'
=> true
ree-1.8.7-2011.03 :002 > GeoIP
NameError: uninitialized constant GeoIP
from (irb):2

Am I missing something?

That's very strange; something must be wrong with your gem
configuration.
Try this:

before = Object.constants
require 'geoip'
p Object.constants-before

That will tell you what global constants (if any) were added by
requiring geoip.

Also, where does "gem show geoip" open up?

Clifford Heath.

@vitobotta
Copy link
Author

Thanks a lot for the quick reply :)

Earlier I was trying the gem with the IRB console, when I got the error. But now I am using it with the Rails console -after adding the gem to the Gemfile as usual- and it works.
I need it with a Rails app now so it's OK :)

Anyway
1)

ree-1.8.7-2011.03 :004 > p Object.constants-before
["Autometal", "FileUtils"]

501 [ ~ ] $ gem show geoip
ERROR: While executing gem ... (RuntimeError)
Unknown command show

but..

502 [ ~ ] $ gem list geoip

*** LOCAL GEMS ***

geoip (1.1.1)

Everything looks otherwise fine on my system and I don't have any other problem apart this (I am using RVM and have also tried to downgrade RubyGems just in case), so I wouldn't know why this is happening.
But anyway with Rails it's working correctly.

Thanks!
Vito

On 8 Jun 2011, at 14:34, cjheath wrote:

On 08/06/2011, at 10:04 PM, vitobotta wrote:

Hi, I am trying to use this gem in an app, but for some reason the
GeoIP class cannot be found:
ree-1.8.7-2011.03 :001 > require 'geoip'
=> true
ree-1.8.7-2011.03 :002 > GeoIP
NameError: uninitialized constant GeoIP
from (irb):2

Am I missing something?

That's very strange; something must be wrong with your gem
configuration.
Try this:

before = Object.constants
require 'geoip'
p Object.constants-before

That will tell you what global constants (if any) were added by
requiring geoip.

Also, where does "gem show geoip" open up?

Clifford Heath.

Reply to this email directly or view it on GitHub:
#13 (comment)

@cjheath
Copy link
Owner

cjheath commented Jun 8, 2011

On 08/06/2011, at 11:41 PM, vitobotta wrote:

ree-1.8.7-2011.03 :004 > p Object.constants-before
["Autometal", "FileUtils"]

.... but no Geoip. Weird. I wonder what Autometal is, it sounds
like a loader type thing that might have interfered with the
require process.

501 [ ~ ] $ gem show geoip
ERROR: While executing gem ... (RuntimeError)

Oh sorry, I meant "gem open", but "gem list" is also good.

502 [ ~ ] $ gem list geoip
*** LOCAL GEMS ***
geoip (1.1.1)

And you're using bundler too? Is the bundle up to date?

Clifford Heath.

@vitobotta
Copy link
Author

Hi Clifford,

thanks - yes I do use bundler and it's up to date. I think I found what the problem was: I had tried another gem (I think autometal-geoip) before finding yours, and it seems like it hadn't beed uninstalled cleanly.
So I don't think it's a problem with your gem :)

On a side note, after playing with the gem and seeing some results, I noticed that the GeoCity Lite database by Maxmind is not good enough for the kind of lookups I need to do, which is mostly IP addresses owned by ISPs and alike.
In these cases, the Lite version of the database doesn't usually return the city at all and while the full version does, it's a bit pricey for my needs.

So luckily I found another service which seems a good fit for what I am trying to do
http://www.readwriteweb.com/hack/2010/09/saying-hi-quova-style.php

I don't need frequent lookups nor many of them during a day, so this seems to work ok for me (for now), although it's a remote service.

Cheers
Vito

On 8 Jun 2011, at 22:21, cjheath wrote:

On 08/06/2011, at 11:41 PM, vitobotta wrote:

ree-1.8.7-2011.03 :004 > p Object.constants-before
["Autometal", "FileUtils"]

.... but no Geoip. Weird. I wonder what Autometal is, it sounds
like a loader type thing that might have interfered with the
require process.

501 [ ~ ] $ gem show geoip
ERROR: While executing gem ... (RuntimeError)

Oh sorry, I meant "gem open", but "gem list" is also good.

502 [ ~ ] $ gem list geoip
*** LOCAL GEMS ***
geoip (1.1.1)

And you're using bundler too? Is the bundle up to date?

Clifford Heath.

Reply to this email directly or view it on GitHub:
#13 (comment)

@rtyler
Copy link

rtyler commented Apr 8, 2019

I believe this issue could be closed 😸

@cjheath cjheath closed this as completed Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants