开发者

Rails 3 + Google Maps without a gem

I'm trying to integrate Rails 3 with Google Maps. I do not want to use a gem -- I just want to generate the array (hash?) used by the JavaScript API. I have this working manually, but not dynamically. I am using Haml, so the ERB examples are throwing me off.

Right now, my info comes out of Redis and is stuffed into a Ruby开发者_Python百科 array in the JavaScript format Google Maps expects. I then try to access the array in my View. It almost-works, but there are no new lines -- it's one giant blob.

How do I fix it? Or what's a better way to do it?

Thanks in advance!


Here's a simplified example:

https://gist.github.com/1017434


This isn't really rails question. The gamps api is javascript - you do it on the client in javascript.

It seems you have some data in redis, i'm assuming it's places you want to map. One way to get that data from redis on the server to javascript on the client is to deserialize it as a JSON string. Then serialize it on the client from the JSON string. Then you would just enumerate though the array of points and plot then using google provided maps api.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜