gmaps4rails: undefined method `model_name' for NilClass:Class

The problem is nothing to do with the gem. @location is nil. Are you passing the value across when you render the form? It seems to be the only bit of code that you have not shown us. See

for how to pass data to the form.

Also have a look at the Rails Guide on debugging with will show you techniques that you can use to debug your code.

Colin