Google maps for Rails v2

TheApneadiving · 42K views · 2013 · 8:31

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the standard setup walkthrough for gmaps4rails v2, both in answers about the gem's changed API and in questions from people following along.

Recommended by 3 people across 3 different months, 2013 to 2017.

What it is

A short screencast by Apneadiving, the author of the gem, introducing version 2 of gmaps4rails (Google Maps for Rails). It walks through setting up a Rails app with a geocoded model and showing markers on a map.

What people said

Recommends Bismark · 2013-11 · Stack Overflow · on “'gmaps4rails' undefined local variable or method 'acts_as_gmappable' rails 3.2.1 routing error”

Check out the Docs of gmaps4rails, since 2.* version you don't have to add the acts_as_gmappable method. Now it uses geocoder. Here is an small tutorial [this video] , that explains how it works.

Recommends user3174983 · 2014-04 · Stack Overflow · on “Gmaps4rails issue, perhaps incompatibilty with gems”

[LINK] When I am trying to enter in reports (at about the 1:19 mark of the video tutorial [this video] ), they are just showing up as blank (see image above). When I try to edit them, the edit page shows blank fields. What could be causing this issue? I named my model "Report" as opposed to User, but otherwise followed the tutorial to a T. Below is my gemfile, thanks for any help you can give :) source ' [LINK] ' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.4' gem 'devise' gem 'protected_attributes' # Use sqlite3 as the database for Active Record group :development do gem 'sqlite3' end # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.2' # Use Uglifier as c

Recommends Simple Lime · 2017-07 · Stack Overflow · on “Google Maps rails 5”

Looking at the gem [LINK] + the youtube video on it's GitHub page. It appears [this video] you need to install the geocoder gem as well. That's what giving you the geocoded_by method. Looking at the geocoder [LINK] , if you add latitude:float longitude:float to your model, it should automatically fetch and update those in the after_validation :geocode you have in your model. From there, you can just pass your latitude and longitude to your view and replace "lat": 0, "lng": 0, with them. Make sure to read through the geocoder gem page, got a couple of useful things on there. Edit For the newest issue, I'm not great with javascript, but I'd try removing the async defer and that &callback=initMap fr

Cites dmt2989 · 2013-11 · Stack Overflow · on “Gmaps4rails V2 - change default zoom”

I'm a complete noob, building my first rails app. I successfully implemented Google-maps-for-rails V2, using apneadiving's tutorial on youtube: [this video] My issue is that for each of my maps, I'm only showing one marker, and when the map loads, it adjusts to be fully zoomed. Searching around, there seems to be a lot of solutions for earlier versions of Gmaps4rails, but with V2, and creating the map via javascript, I can't seem to find a solution that works. For reference, my code is below: View: <script type="text/javascript"> handler = Gmaps.build('Google'); handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){ markers = handler.addMarkers(<%=raw @hash.to_json %>); handler.boun

Cites conent · 2013-11 · Stack Overflow · on “how to set a zoom level using Gmap4rails?”

I've just setup a new project following this video [this video] . I was wondering how can I set the map zoom level in a project like this. I've looked at the src on github and since in map.coffee there isn't something like zoomTo: (zoomLvl)-> @getServiceObject().setZoom(zoomLvl) I don't have any idea how to do it. So can anyone help me? I've tried this kind of solution as suggested here ( zoom in to particular region in gmap4rails [LINK] ) but with any good result: Gmaps.map.callback = function() { google.maps.event.addListenerOnce(Gmaps.map.getMapObject(), 'idle', function(){ var bounds = new google.maps.LatLngBounds(new google.maps.LatLng(10, 0), new google.maps.LatLng(0, 10)); Gmaps.map.servic

Cites user3174983 · 2014-04 · Stack Overflow · on “Google Maps API View and populate issues with Gmaps4rails Gem in Rails 4”

I am trying to follow this tutorial here [this video] to add a new scaffold to my app. In the video, the model was called User but my model is called Reports. I have made it to 4:14 but the map is not loading properly; see here for screenshot. It does not zoom in, only shows blue. When I drag it one way or the other, it turns gray. [LINK] I have followed along with the tutorial at this point precisely, but I am wondering if perhaps the scaffold is incompatible with my other models? OR, is the bootstrap CSS template messing up the view of this map. The problems are twofold--the view is not loading correctly, and the reports are not populating on the map. I have pasted some of my source code below,

Cites apneadiving · 2014-06 · Stack Overflow · on “Google maps not working for Ruby on Rails 4.1.1”

This tutorial is deprecated, only works for 1.x version. Documentation in wiki states to follow this one: [this video]

Cites asdjkag · 2014-06 · Stack Overflow · on “Google Map API Marker add dynamic lable in Ruby On Rails”

I wan to display many locations of sensors on a map, I need to display all current sensor value on the marker(not on infowindow,user can see data without click marker) Is not realistic for me to create many different icon and change icon. Is there a way to display dynamic data on marker? Say display a number label on top of marker. I find one but cant translate it into ruby on rails code. Here is the link i found for java [LINK] . And here is a link [this video] useful for create gmaps on ROR This is what I have now.Using gem Gmaps4rails. In app/asssts/gmaptest.js.coffee class CustomMarkerBuilder extends Gmaps.Google.Builders.Marker create_marker: -> options = _.extend @marker_options(), @rich_ma

Cites asdjkag · 2014-06 · Stack Overflow · on “Google Map API Marker add dynamic lable in Ruby On Rails”

I read your video [this video] again, the file [LINK] from gmaps4rails coffee script is to be put on controller's coffee file under app/assets/javascripts/gmaptest.js.coffee .the header file and html file I also follow ur video.The problem is, after I add line buildMap( ) in view/gmaptest/index.html.erb my whole google map window disappear.It happens when I trying to follow your video also.

Cites fatfrog · 2015-05 · Stack Overflow · on “Geokit undefined method `acts_as_mappable' rails”

This is the demo I used - I remember doing tutorials that where using acts_as_mappable, and later discovered that has been depreciated. [this video]