Created
April 2, 2012 05:30
-
-
Save ornerymoose/2281015 to your computer and use it in GitHub Desktop.
Show of Map Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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