{"action":"closed","issue":{"url":"https://api.github.com/repos/apneadiving/Google-Maps-for-Rails/issues/478","labels_url":"https://api.github.com/repos/apneadiving/Google-Maps-for-Rails/issues/478/labels{/name}","comments_url":"https://api.github.com/repos/apneadiving/Google-Maps-for-Rails/issues/478/comments","events_url":"https://api.github.com/repos/apneadiving/Google-Maps-for-Rails/issues/478/events","html_url":"https://github.com/apneadiving/Google-Maps-for-Rails/issues/478","id":67641289,"number":478,"title":"Attach custom data to markers","user":{"login":"fabn","id":324213,"avatar_url":"https://avatars.githubusercontent.com/u/324213?v=3","gravatar_id":"","url":"https://api.github.com/users/fabn","html_url":"https://github.com/fabn","followers_url":"https://api.github.com/users/fabn/followers","following_url":"https://api.github.com/users/fabn/following{/other_user}","gists_url":"https://api.github.com/users/fabn/gists{/gist_id}","starred_url":"https://api.github.com/users/fabn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabn/subscriptions","organizations_url":"https://api.github.com/users/fabn/orgs","repos_url":"https://api.github.com/users/fabn/repos","events_url":"https://api.github.com/users/fabn/events{/privacy}","received_events_url":"https://api.github.com/users/fabn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-10T17:15:37Z","updated_at":"2015-05-14T15:36:08Z","closed_at":"2015-05-14T15:36:08Z","body":"I'm using the `MarkersBuilder` ruby helper to build some marker data and it's awesome, however I have an issue. In the [rubydoc](https://github.com/apneadiving/Google-Maps-for-Rails/blob/9388a062594f9ba5d8022f611284b4a7218782e9/lib/gmaps4rails/markers_builder.rb#L22) you attach custom data to the marker with this syntax:\r\n\r\n```ruby\r\nmarkers = Gmaps4rails.build_markers(collection) do |(code, state), marker|\r\n  marker.lat state['latitude']\r\n  marker.lng state['longitude']\r\n  marker.title state['name']\r\n  marker.json state: code, id: state.id # here are my custom data\r\nend\r\n```\r\n\r\nWhat's that for? I'm adding markers to map using the handler:\r\n\r\n```coffeescript\r\n  addMarkers: (data)=>\r\n    @deleteMarkers()\r\n    @markers = @handler.addMarkers(data)\r\n    # Here I'm attaching a custom click handler\r\n    google.maps.event.addListener(m.getServiceObject(), 'click', @myClickHandler) for m in @markers\r\n\r\n  myClickHandler: (evt) ->\r\n    # How to get state code from the clicked marker???\r\n\r\n  # Later\r\n  $.getJSON(myUrl).done(@addMarkers)\r\n```\r\n\r\nIn `myClickHandler` I don't know how to access the `code` and the `id` I stored in the ruby code for the clicked marker."}}