Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:41:26+00:00 2026-06-05T05:41:26+00:00

I am using rails 3.2.3 and gmaps4rails gem. I have one model called contact.

  • 0

I am using rails 3.2.3 and gmaps4rails gem.

I have one model called contact. In the contact object I have one filed named address.

Now I have defined the contact as acts_as_gmappable and gmaps4rails_address takes the address field to show as a marker in the google map.

Now, while we add new contact, I want to add a feature such that the address will be auto filled when we click on the google map with the clicked location.

How can I do that with the help of gmaps4rails gem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:41:27+00:00Added an answer on June 5, 2026 at 5:41 am

    There is a good guide on the wiki that might help. Look for the section “Drop a marker and update fields attribute in a form”

    https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Javascript-goodies

    Simply include the javascript, and update the following with your actual field IDs (you might want some hidden :lat :lon fields on your form)

    $('#location_attributes_latitude').val(latLng.lat());
    $('#location_attributes_longitude').val(latLng.lng());
    $('#location_attributes_gmaps_zoom').val(Gmaps.map.serviceObject.getZoom());
    

    On save, you’ll need to check whether the user has entered an address manually, or used the map.

    If they’ve used the map, you’ll need a method to reverse geocode and fetch an address from Google using the :lat :lon values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: Using Rails 3.1 and current delayed_job gem. I have a User model that
Using Rails 3, I have an account model which has_many addresses. In the address
Using: Rails 3.1.1 I have a controller/model/view called Category that is built up on
I've been using the gmaps4rails gem for a while in rails 3.1 and it
Using Rails 3 active relation, I have a scope: scope :duplicate_contact, lambda {|contact| where(
I'm using the amazing gem gmaps4rails in a Rails project. It works just fine
Using Rails 3.0.7. I have a simple form which shows all records from one
Im using Rails 3.0.3 I have a Model Bill: class Bill < ActiveRecord::Base has_many
Im using Rails 2.3.5 and I have a model, let's call it Post. I
Using: Rails 3.0.3 I have validations such as this one: validates_numericality_of :person_weight_kg, :greater_than =>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.