开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜