Google Places ActiveResource
<p>I'm trying to write an ActiveResources model to interact with the Google Places API - <a href="https://developers.google.com/places/web-service/search#PlaceSearchRequests" rel="nofollow">https://developers.google.com/places/web-service/search#PlaceSearchRequests</a></p>

<p>I see the API requires a key and some parameters in order to fetch results. So my question is: how do I properly add the API key to the request, because right now I have no idea if it is actually going through and also how do I set up the model in order to pass the parameters when later I want to do something like:</p>

<pre><code>GooglePlace.where(query: 'whatever')
</code></pre>

<p>What I have so far is just the default boilerplate for an ActiveResource, with no clue as how to add the missing information:</p>

<pre><code>class GooglePlace &lt; ActiveResource::Base
  self.site = 'https://maps.googleapis.com/maps/api/place/textsearch/json?query=pool'
  @key = API_KEY
end
</code></pre>

<p>And my index action method in the controller looks like this:</p>

<pre><code>def index
  @users = GooglePlace.where(query: 'pool')
end
</code></pre>

<p>In the console, all I get is this:</p>

<pre><code>Started GET "/google_places" for ::1 at 2016-02-27 16:41:11 -0300
Processing by GooglePlacesController#index as HTML
  Rendered google_places/index.html.erb within layouts/application (61.0ms)
Completed 500 Internal Server Error in 2027ms (ActiveRecord: 0.0ms)
</code></pre>

<p>Any help will be much appreciated. Thank you for your time!</p>