开发者

gmaps4rails dynamic load question

开发者 https://www.devze.com 2023-03-05 14:31 出处:网络
Trying to modify the screencast to be unobtrusive. Have an action (updatemap) that completes the following query:

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 %>);
0

精彩评论

暂无评论...
验证码 换一张
取 消