Skip to content

Instantly share code, notes, and snippets.

@fiedl
Created September 17, 2013 21:00
Show Gist options
  • Save fiedl/6600555 to your computer and use it in GitHub Desktop.
Save fiedl/6600555 to your computer and use it in GitHub Desktop.
gmaps4rails with turbolinks
/* app/assets/stylesheets/application.css
*
* ...
*= require_self
*= require gmaps4rails
*= require_tree .
*/
<!-- app/views/layouts/application.html.erb -->
<html>
<head>
...
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= gmaps4rails_api_script_tags # <-- THIS IS NEW ----------------- %>
<%= csrf_meta_tags %>
</head>
<body>
...
<%= yield %>
<%= yield :scripts %>
</body>
</html>
// app/assets/javascripts/application.js
//
// ...
//= require jquery
//= require jquery_ujs
//= require turbolinks
//
// make sure to include these scripts if they are installed to vendor/assets rather than app/assets:
//= require gmaps4rails/base
//= require gmaps4rails/google
//= require_tree .
# ...
gem 'turbolinks'
gem 'gmaps4rails', '~> 2.0.1', git: 'https://github.com/fiedl/Google-Maps-for-Rails'
# then run 'bundle install' and restart the rails server.
@danil-z
Copy link

danil-z commented Sep 18, 2013

i have this partial in my view(slim)

= gmaps({ "map_options" => { "center_latitude" => 55.751244, "center_longitude" => 37.618423, "zoom" => 4, "auto_adjust" => true, 'libraries' => ['places'] } })

and places library doesn't load

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment