Comments (9)
- Install libmaxminddb
- Put into your Gemfile "gem 'geoip2', github: 'da4nik/geoip2'" or "gem 'geoip2', github: 'da4nik/geoip2' require: 'GeoIP2'"
- bundle install
- download local GeoLite2 database file
- use it
let me know if there are still questions.
from geoip2.
I had some issues installing this until I changed gem 'geoip2', github: 'da4nik/geoip2'
to gem 'geoip2', github: 'da4nik/geoip2', require: 'GeoIP2'
in my Gemfile. This is the only place in the repo where I found anything on setting the require option as such, so I'm wondering if this should be added to the Readme? Just a suggestion, thanks for the gem :)
from geoip2.
Basically I am trying to use this from within a fluentd plugin. At the top of my class I have "required 'Geoip2'
then in a method in my class I do GeoIP2::locate(....
and it errors with
NameError: uninitialized constant MyClass::GeoIP2
from geoip2.
Also tried a simple ruby file like your example and get
x.rb:3:in `
': uninitialized constant GeoIP2 (NameError)require 'GeoIP2'
city = GeoIP2::locate('/patch/to/GeoLite2-City.mmdb', 'some.ip', 'en')
from geoip2.
Hey guys, i've just updated gem with autorequire fix and basic configuration.
from geoip2.
Pulled down the latest and did:
gem build geoip2.gemspec
Successfully built RubyGem
Name: geoip2
Version: 0.0.7
File: geoip2-0.0.7.gemfluent-gem install geoip2-0.0.7.gem
Building native extensions. This could take a while...
Successfully installed geoip2-0.0.7
Parsing documentation for geoip2-0.0.7
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/GeoIP2.bundle, skipping
1 gem installed
Then when trying to run, (note this is not a rails project)
error_class=NameError error=NameError: uninitialized constant MyClassName::GeoIP2
My class does
require 'GeoIP2' at the top and then in an instance method
geoip = GeoIP2::locate('/my/path/GeoLite2-City.mmdb', someIpAddr, 'en')
from geoip2.
I've had to do
require 'geoip2.o'
In order to get the GeoIP2 constant exported correctly (OSX 10.9)
from geoip2.
Merged pull request for fixing this.
from geoip2.
TL;DR brew install libmaxminddb
from geoip2.
Related Issues (13)
- Updated for refactored libmaxminddb HOT 1
- Rename gem? HOT 7
- Doesn't compile in Mac OS X HOT 8
- Geoip2 0.0.8 / Ruby 2.0.0 Compile Issue HOT 1
- Locale fallback HOT 1
- Locales as symbols HOT 1
- unable to open file /kpdata/maxmind/GeoLite2-City.mmdb (IOError)
- test
- Failed to compile under OSX 10.11 HOT 4
- Problem with the gem spec file
- The libmaxminddb API has changed HOT 1
- Build fails on OSX with Ruby 2.1 against libmaxminddb 0.5.3 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoip2.