apneadiving/Google-Maps-for-Rails — Issue #157: After_create problem with acts_as_gmappable
Author: Dinuz
Created: 2012-03-07 01:59:04+00:00
State: open

I built an app that creates a user model and automatically creates a profile model using the after_create callback method in the model. The model profile belongs to users, and users has one profile.

Now I have another model called location, that use the gem geocoder with the current_ip address of the client machine, to pull out the current location of the user, and save the address, the latitude and longitude in the same model.

Everything works perfectly and fine, except, when I try to add to the location model, acts_as_gmappable, then during the registration process, the same model is not more automatically created, and this prevent then the creation of the database column address and obviously consequently, this will bring to an error of gmapsforails.

How I can use the after_create callback in the profile model, and the automatically create the location model, and its column (longitude, latitude, address, ip_address)?

I think it's a problem related with which method is called before the after_create or the gmapsforrails one...this because, if I cut from my location model the call to acts_as_gmappable, register the user, and after past back in the location model the acts_as_gmappable, everything works fine, and the google map is showed.

Thanks to everyone that could in someway highlight my mind...