Alex Alex - 2 years ago 193
Ruby Question

Using gmaps4rails with https/SSL

I'm a big fan of gmaps4rails - it's made adding maps to our web app very easy. The only problem I'm hitting now is that if you use it on an https page, then you get security warnings about mixed content. The google maps api does support https, so I think it's just a question of changing the script references from http to https. Unfortunately I think it's hidden behind the "acts_as_gmappable" statement - I was hoping for a content_for block I could modify.

Is there an easy way to make it use the https version of the API?

Many thanks,


Answer Source

It's not a very obvious title but your solution lies in the Miscellaneous section of the gem's wiki.

Just have a look:

<%= gmaps( data_hash, enable_css, enable_js) %>

enable_css and enable_js are booleans.

So if you do:

<%= gmaps( data_hash, true, false) %>

It won't load any js. his way you can add whatever you want by yourself. Don't forget to include the gmaps4rails.js file!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download