kristianmandrup / gmaps-autocomplete-rails

Google Maps v3 search with jQuery UI Autocomplete, ready for use with Rails asset pipeline
MIT License
73 stars 35 forks source link

Uncaught ReferenceError and TypeError #16

Closed jgunnink closed 8 years ago

jgunnink commented 8 years ago

Following the readme, I have encountered two errors when trying to use this gem.

Uncaught ReferenceError: google is not defined and Uncaught TypeError: GmapsCompleterDefaultAssist is not a function

More detail:

Uncaught ReferenceError: google is not defined
(anonymous function) @ gmaps-auto-complete.self-4f972ec52feb2af3169e444e2e9d9c84e6798f29ae76241fc5346c6baccd0a9f.js?body=1:242
(anonymous function) @ gmaps-auto-complete.self-4f972ec52feb2af3169e444e2e9d9c84e6798f29ae76241fc5346c6baccd0a9f.js?body=1:293
Uncaught TypeError: GmapsCompleterDefaultAssist is not a function
GmapsCompleter.init @ gmaps-auto-complete.self-4f972ec52feb2af3169e444e2e9d9c84e6798f29ae76241fc5346c6baccd0a9f.js?body=1:58
GmapsCompleter @ gmaps-auto-complete.self-4f972ec52feb2af3169e444e2e9d9c84e6798f29ae76241fc5346c6baccd0a9f.js?body=1:42
(anonymous function) @ gmaps_address_complete.self-05bb90d5989795f4e2417891ae404cf8de01fc8974d3a31665afe857b7954355.js?body=:4
fire @ jquery.self-c64a74367bda6ef8b860f19e74df08927ca99d2be2ac934e9e92d5fd361e0da4.js?body=1:3233
self.fireWith @ jquery.self-c64a74367bda6ef8b860f19e74df08927ca99d2be2ac934e9e92d5fd361e0da4.js?body=1:3363
jQuery.extend.ready @ jquery.self-c64a74367bda6ef8b860f19e74df08927ca99d2be2ac934e9e92d5fd361e0da4.js?body=1:3583
completed @ jquery.self-c64a74367bda6ef8b860f19e74df08927ca99d2be2ac934e9e92d5fd361e0da4.js?body=1:3618
kristianmandrup commented 8 years ago

Uncaught ReferenceError: google is not defined

Sounds like you have not imported google maps before this lib.

Uncaught TypeError: GmapsCompleterDefaultAssist is not a function

Check the code, make a patch and a pull to fix it. I haven't touched Ruby the past ~3 years... I have merged a few pulls without testing. Sorry.

Looking at the .coffee code` however, it looks fine.

I'd suggest you clone the repo and take it for a spin on its own first.

jgunnink commented 8 years ago

Yeah, the coffee code seems fine to me also, I did not realise that it importing google maps was requirement as the readme did not specify it - thanks anyway. FWIW, the google dev docs have been recently updated and I was able to solve my issue quickly using their implementation using their API.

kristianmandrup commented 8 years ago

Great! Just updated the troubleshooting section accordingly ;) Feel free to improve this lib as you see fit.