gmaps4rails dynamic load question
Trying to modify the screencast to be unobtrusive. Have an action (updatemap) that completes the following query:
开发者_StackOverflow中文版 @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 %>);
精彩评论