I'm new to Rails and developing in general and am trying to use the Twitter gem to search for tweets by location and keywords in my Rails app. Following the documentation at http://www.rubydoc.info/gems/twitter I have been able to figure out how to search for tweets by keyword (in my case #restaurant) but not filter this by my user's location.
I am currently trying the following:
In my controller
@search = client.search("#restaurant", result_type "recent", geocode: "#{@lat}, #{@lon}, #{@radius}mi")
In my view:
<% @search.take(3).each do |tweet| %> <% tweet.text %> <% end %>
If the geocode parameter is taken out I get 3 tweets with "#restaurant", but with the geocode nothing is returned. Is there a problem with my code?
As I am so new to programming, I could be approaching this problem completely wrong and I'm also open to any alternative approaches.