Skip to content

Instantly share code, notes, and snippets.

@sharnie
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharnie/7ff680fd8bf637275b2e to your computer and use it in GitHub Desktop.
Save sharnie/7ff680fd8bf637275b2e to your computer and use it in GitHub Desktop.
class SearchController < ApplicationController
def index
access_token = "YOUR ACCESS TOKEN HERE" # should have been session[:access_token]. Never store credentials in your code
client = Instagram.client(access_token: access_token)
geocoder = Geocoder.search(params[:q] || "brooklyn, new york")
lat = geocoder.first.data["geometry"]["location"]["lat"]
lng = geocoder.first.data["geometry"]["location"]["lng"]
@results = client.location_search(lat, lng)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment