Вопрос

Trying to modify the screencast to be unobtrusive. Have an action (updatemap) that completes the following query:

 @markers = Location.active.all.to_gmaps4rails

Then in updatemap.js.erb:

Gmaps4Rails.replace_markers(?);

With it empty the markers clear so I know that works but can't figure the proper syntax to go between the parenthesis to display the new markers.

@markers, is stored in JSON format but how do get them to be entered, tried <%= @markers %> but that failed.

Это было полезно?

Решение

You should declare the json as safe or render it raw:

Gmaps4Rails(<%=raw @markers %>);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top