Fix MapLocation json_data to return mappable ids
Until we correctly make MapLocation relation with mappables a polymorphic one... we'll need to return the investment_id and proposal_id values. Right now it was returning the MapLocation ID, and the JS was making a call searching for an Investment with the MapLocation ID... sometimes finding a record with same ID but totally NOT the one associated to the MapLocation.
This commit is contained in:
@@ -99,7 +99,7 @@ App.Map =
|
||||
for i in addMarkerInvestments
|
||||
if App.Map.validCoordinates(i)
|
||||
marker = createMarker(i.lat, i.long)
|
||||
marker.options['id'] = i.id
|
||||
marker.options['id'] = i.investment_id
|
||||
|
||||
marker.on 'click', openMarkerPopup
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ class MapLocation < ActiveRecord::Base
|
||||
|
||||
def json_data
|
||||
{
|
||||
id: id,
|
||||
investment_id: investment_id,
|
||||
proposal_id: proposal_id,
|
||||
lat: latitude,
|
||||
long: longitude
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user