Ruby on Rails Wednesday, October 21, 2015

I'm using meijer's geosearch in a leaflet map. It was working fine but I've suddenly broken it and I don't know how. The maps still appears, but the search box doen't appear in the map. The code that breaks the app is:

    new L.Control.GeoSearch({
      provider
: new L.GeoSearch.Provider.OpenStreetMap(),
      showMarker
: false,
      position
: 'topright',
      retainZoomLevel
: false
   
}).addTo(map);

I don't think it can find the geosearch js or css files, even though I've clearly included them in application.html.erb:

    <%= stylesheet_link_tag "leaflet.css" %>
   
<%= javascript_include_tag "leaflet.js" %>
   
<%= stylesheet_link_tag "l.geosearch.css" %>
   
<%= javascript_include_tag "l.control.geosearch.js" %>
   
<%= javascript_include_tag "l.geosearch.provider.openstreetmap.js" %>

I think the turning point might have been when I typed `bundle exec rake assets:precompile` at the command line (I also did `RAILS_ENV=production bundle exec rake assets:precompile`). Why would that break geosearch? 
I have deleted my public/assets folder, but that didn't make any difference.

Also, the console doesn't show any complaints about broken geosearch.js files or not finding them. I am, as usual, baffled.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5cd335a9-49eb-4479-b1eb-da5f3edd44e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment