Rails Geocoder object does not contain postcode

47 Views Asked by At

Using rails Geocoder gem.Trying to search with postcode but it's returning nil while the postcode is valid. Geocoder.search(454774) => nil

sample postcode : 454774

Note : nil value is coming because the postcode is missing in search object.

Any solution?

1

There are 1 best solutions below

1
Willard Moore On

I don't think it likes that you're giving it an integer. Looking at the github I am expecting that they want you to give them a string instead. I'm not personally familiar with a zip code of this length. As long as it's a valid zip code I would expect it to return something. Does this work?

Geocoder.search("454774")