NameError / unitialized constant

Ok I'm trying to use the Yelp gem which I've installed. Following the documention I do the following in my CONTROLLER:

in 'location_controller.rb'

def search

client = Yelp::Client.new request = Yelp::Review::Request::Location.new(                                                   :address => '650 Mission St',                                                   :city => 'San Francisco',                                                   :state => 'CA',                                                   :radius => 2,                                                   :term => 'cream puffs',                                                   :yws_id => 'xxxx') response = client.search(request)

@yelp_results = response end

Well the first line causes the following error:

NameError (uninitialized constant LocationsController::Yelp):     /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:492:in `const_missing'     /app/controllers/locations_controller.rb:18:in `search'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `send'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `perform_action_withou\ t_filters'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in `call_filters'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in `perform_action_with\ out_benchmark'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_\ without_rescue'

Am i not supposed to instantiate this in the controller?

Thanks

1 ) have you restarted your server? 2) Did you do require 'yelp' in config/environment.rb? 3) ???

adding "require 'yelp'" to config/environment.rb did the trick.

thanks!

Ryan Bigg wrote: