Skip to content

Instantly share code, notes, and snippets.

@RyanFriedman
Created December 1, 2011 04:26
Show Gist options
  • Save RyanFriedman/1413620 to your computer and use it in GitHub Desktop.
Save RyanFriedman/1413620 to your computer and use it in GitHub Desktop.
<%= gmaps({
"map_options" => { "type" => "ROADMAP", "center_longitude" => 180, "zoom" => 3, "auto_adjust" => true},
"markers" => {
"data" => json_array(@posts).to_json
}
}) %>
module PostsHelper
def json_array(posts)
posts.map do |post|
hash = {
"description" => "#{post.title}<br />#{post.company}<br />",
"title" => "",
"width" => "",
"height" => "",
"lng" => post.longitude.to_s(),
"lat" => post.latitude.to_s(),
}
hash
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment