Reputation: 1530
So I tried to submit a location-based search by providing a city to my Geocoder method Geocoder.coordinates("Miami")
, but my Rails app threw this exception:
EOFError in ListingsController#search
end of file reached
My development log doesn't really explain what's going on:
And my code cuts off and throws the exception at the Geocoder call in my controller:
def search
@favorited_listing = FavoritedListing.new
@listings = Listing.search(params[:search].downcase)
@results = Array.new
@cityCoordinates = Geocoder.coordinates(params[:city]) # <= This is where the exception gets thrown
if !params[:city].nil? && params[:city] != ""
@results = @listings.select { |listing| listing.location.distance_from(@cityCoordinates) < 50 }
else
@results = @listings
end
@listings_json = []
@coordinates = @results.map do |listing|
@listings_json << listing.as_json(:include => [:location, :pictures])
end
respond_with(@results)
end
Things I've tried from other posts about this issue:
rm -Rf tmp/cache/assets/development/sprockets/*
Neither of these have worked. Does anyone know what is happening or can point me in the right direction?
Upvotes: 1
Views: 142
Reputation: 3992
I have found out that Geocoder, geokit and geokit-rails all needed updating and that has fixed the problem of EoF exceptions.
Upvotes: 0
Reputation: 1530
I just ran bundle update
and it fixed the issue. I believe the problem was my net-ssh
gem or faraday
gem (most likely faraday in my opinion) causing a problem with trying to make http requests. I am going to look into it more and update this response when I learn some more about it.
Upvotes: 1