Various markers on Google Maps using gmaps4rails

With gmaps4rails, there is a way to define a custom token . But the same number is displayed for each record in the database.

How can I show a different marker for each database record, for example, in Google Latitude? Preferably through your own database column or through a sprite if there are only pictures for categories / groups and not individual users.

+5
source share
1 answer

Based on the response of apneadivings, two possibly shorter ways come to mind:

Generic:

def gmaps4rails_marker_picture
    {
    "picture" => self.image_path, # image_path column has to contain something like '/assets/my_pic.jpg'.
    "width" => 32, #beware to resize your pictures properly
    "height" => 32 #beware to resize your pictures properly
    }
end

:

def gmaps4rails_marker_picture
    {
    "picture" => "/images/" + self.category + ".png",
    "width" => 32, #beware to resize your pictures properly
    "height" => 32 #beware to resize your pictures properly
    }
end

, , . , , .

+4

All Articles