Skip to content

Instantly share code, notes, and snippets.

@sharnie
Last active August 29, 2015 14:01
Show Gist options
  • Save sharnie/ec52759d501ba1bfb3b5 to your computer and use it in GitHub Desktop.
Save sharnie/ec52759d501ba1bfb3b5 to your computer and use it in GitHub Desktop.
class SearchController < ApplicationController
def index
access_token = " " # <= YOUR ACCESS TOKEN HERE
client = Instagram.client(access_token: access_token)
default_search = client.tag_search('chicken')
if params[:q]
search_query = client.tag_search(params[:q])
@tag = search_query.present? ? search_query : default_search
else
@tag = default_search
end
@tag = @tag.first.name
@results = client.tag_recent_media(@tag)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment