Cholis
Cholis

Reputation: 105

Google Places API (Adding API Key) Question

I installed the google places gem on Rails. When I try to set up the @client = GooglePlaces::Client.new(API_KEY) I get several errors.

I entered my API key and replaced client with restaurant. I tried running this in the folder and I get a syntax error.

When I tried to run the same thing in console, I get the following error:

NameError (uninitialized constant here)

Can anyone let me know what is going on?

Upvotes: 0

Views: 60

Answers (1)

Ursus
Ursus

Reputation: 30056

You're passing the API key like if it was defined somehow, but it's not. That should be a string

@client = GooglePlaces::Client.new("your api key") # between quotes

or using a variable

api_key = "your api key"
@client = GooglePlaces::Client.new(api_key)

Upvotes: 1

Related Questions