Skip to content

Instantly share code, notes, and snippets.

@ornerymoose
Created April 2, 2012 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ornerymoose/2281015 to your computer and use it in GitHub Desktop.
Save ornerymoose/2281015 to your computer and use it in GitHub Desktop.
Show of Map Controller
def show
@map = Map.find(params[:id])
loc_one = @map.to_location_id.as_json(:only => [:latitude, :longitude])
loc_two = @map.from_location_id.as_json(:only => [:latitude, :longitude])
dave_loc = [ loc_one, loc_two]
dave_loc = dave_loc.map do |marker|
{ lng: marker['longitude'], lat: marker['latitude'] }
end
map = [ dave_loc ]
@mapz = map.to_json
respond_to do |format|
format.html # show.html.erb
format.json { render json: @map }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment