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

  • Home
  • SEARCH
  • 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 8764747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:06:43+00:00 2026-06-13T16:06:43+00:00

I am able to use the basic map display capabilities in gmaps4rails with mongoid,

  • 0

I am able to use the basic map display capabilities in gmaps4rails with mongoid, which is great, but Im falling short with more advanced features. I think I am missing some basics and looking for guidance.
I am able to get the basic geocoding to work with fields named :latitude :longitude and :gmaps but when I try to use an array, as suggested by the readme, I am getting nowhere. I’ve read the Mongoid tips in the wiki to no avail.

Can anyone point me in the right direction?

Update;
Since Ive gotten no responses, here is some code examples,

The Model

working;

class Account
  include Mongoid::Document
  include Gmaps4rails::ActsAsGmappable
  acts_as_gmappable

  field :account_no
  field :owner_name
  field :address
  field :latitude,  :type => Float
  field :longitude, :type => Float
  field :gmaps,     :type => Boolean

  def gmaps4rails_address
    "#{self.address}"
  end

end 

Not working

 class Account
  include Mongoid::Document
  include Gmaps4rails::ActsAsGmappable
  acts_as_gmappable :position => :location

  field :account_no
  field :owner_name
  field :address
  field :location, :type => Array

  def gmaps4rails_address
  "#{self.address}"
  end

end 

Based on the code snippets in the gmaps4rails readme this should work to geocode the address into the location array but I get this error

NoMethodError: undefined method `gmaps' for #<Account:0x007fc47d051ba0>
  • 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-13T16:06:44+00:00Added an answer on June 13, 2026 at 4:06 pm

    As explained here, gmaps is a boolean which purpose is to prevent multiple geocoding of the same address.

    So the field is necessary, unless you tell it explicitly (see same doc)

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

Sidebar

Related Questions

I am able to use: C:\Program Files (x86)\Java>javac -classpath mail.jar myFile.java to compile,but when
This could be a very basic question, but hopefully someone will be able to
I have an app that needs to be able use either an sqlite3 datebase
I am able to use WebGrid in any controller like: var grid = new
The init() is able to use the parameter passed to it in this example:
I was able to use the code in this answer to access a value
Is anyone able to use Scala IDE in Eclipse with syntax highlighting showing different
I want to be able to use a wildcard in string::find and then fetch
I want to be able to use mklink to create symbolic links on my
I want to be able to use the iPhones Mail.app inside my application so

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.