theKindOfMe

June 30, 2011

Fixing foursquare2 gem: NameError: uninitialized constant MultiJson

Filed under: Uncategorized — Tags: , , , — yasi8h @ 12:00 pm

If you get a error similar to the one bellow when you try to use (perform a simple task such as get a venue) from the foursquare2 gem. You are probably missing the multi_json gem.

NameError: uninitialized constant MultiJson
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday_middleware-0.6.5/lib/faraday/response/parse_json.rb:16:in `parse’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/response.rb:17:in `on_complete’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/response.rb:9:in `block in call’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/response.rb:62:in `on_complete’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/response.rb:8:in `call’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/response.rb:8:in `call’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/adapter/net_http.rb:63:in `call’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/request.rb:88:in `run’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/request.rb:28:in `run’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/connection.rb:170:in `run_request’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/faraday-0.6.1/lib/faraday/connection.rb:64:in `get’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/foursquare2-1.1.0/lib/foursquare2/venues.rb:9:in `venue’
from (irb):6
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start’
from /Users/jamesx/.rvm/gems/ruby-1.9.2-p180@snipwits3/gems/railties-3.0.7/lib/rails/commands.rb:23:in `’
from script/rails:6:in `require’
from script/rails:6:in `’ruby-1.9.2-p180 :007 >

So to fix it, just add gem ‘multi_json’ to your Gemfile.

Create a free website or blog at WordPress.com.