class MapsController < ApplicationController def index respond_to do |format| format.html format.json { events = Event.moderated.future.joins(:related_city).includes(:related_city) #@cities_lug = City.joins :lugs render json: events.collect { |event| { type: 'Feature', properties: { name: event.title, popupContent: "#{event.city}: #{event.title}", }, geometry: { type: 'Point', coordinates: [event.related_city.longitude, event.related_city.latitude] } } } } end end end