Hamza Ouaghad
Hamza Ouaghad

Reputation: 589

Why Gmaps4rails' marker.picture not showing the customized image of the marker?

I placed the the custom icon in assets/images/logo.png

and in the controller there is :

marker.picture({
    "url" => "logo.png" ,
    "width" => 32 ,
    "height" => 32})

I even tried replacing logo.png by \assets\images\logo.png but it does not work.

I checked the size of the logo and it is the same as above.

What is happening?

Update #1 : I tried using image_path & asset_path and non of them has done the work.

Upvotes: 0

Views: 324

Answers (1)

apneadiving
apneadiving

Reputation: 115531

Use view_context.image_path

The bug is not related to gmaps4rails, which only expects a valid path or url.

It's linked to Rails which doesnt let controller access some view helpers, so you have to use the view_context to get them.

Upvotes: 3

Related Questions