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 8996325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:44:22+00:00 2026-06-15T23:44:22+00:00

In try to use gmaps4rails in my ActiveAdmin / Rails app. To do so,

  • 0

In try to use gmaps4rails in my ActiveAdmin / Rails app. To do so, I have added the following in my Gemfile:

gem 'gmaps4rails'

and ran a “bundle”. I updated the ‘show’ method in app/admin/device.rb file with:

show do 
  attributes_table do
    row :name
  end

  # Get device location
  @markers = Location.all.to_gmaps4rails
  div do
    render "map"
  end
end

In the app/views/admin/devices/_map.html.erb I have the following code:

<%= stylesheet_link_tag 'gmaps4rails' %>
<%= gmaps4rails(@markers) %>
<%= yield :scripts %>

In app/assets/javascripts/application.js:

//= require gmaps4rails/gmaps4rails.googlemaps
//= require gmaps4rails/gmaps4rails.base
//= require jquery
//= require jquery_ujs
//= require_tree .

And in my app/models/location.rb:

class Location < ActiveRecord::Base
  acts_as_gmappable

  attr_accessible :latitude, :longitude

  def gmaps4rails_address
    "#{self.latitude}, #{self.longitude}" 
  end

  def location
    [:latitude, :longitude]
  end
end

When I go on the show page of a device, the map does not shows up (all blank). Is there any configuration I missed ?

UPDATE

I have checked with chrome developer tools and noticed the following error:

Uncaught SyntaxError: Unexpected token ;

that make reference to the line:

Gmaps.map.markers = ;
  • 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-15T23:44:23+00:00Added an answer on June 15, 2026 at 11:44 pm

    Fix with the following:

    div do
      markers = Location.all.to_gmaps4rails
      render "map", { :markers => markers }
    end
    

    and :

    <%= stylesheet_link_tag 'gmaps4rails' %>
    <%= gmaps({
            "map_options" => { "zoom" => 2, "auto_adjust" => false},
            "markers"     => { "data" => markers }
            })
    %>
    <%= yield :scripts %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try use string as a regular expression pattern but I've following errors PHP
I have a problem with Automapper when I try use custom resolver which uses
if try implemnt my first MVVM in WPF app. I have old app based
I try use gssapi32.dll in my application but I receive exception when app start
Hi i try use Nlog in with caliburn micro, I have use this tutorial
I have gotten some reports from users of crashes when try use my application
I have problems with PHP in Ubuntu 10.04. When I try use mysqli_result::fetch_all this
When i try use a webservice i get the following exception. My main question
I try use a integer array in java with the code below: public static
I try to use a variable in my kshell script but can't get a

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.