Re-namespacing a bit to clear out some fairly old stuff from the top level
This commit is contained in:
28
oldstuff/map-mash/app/controllers/maps_controller.rb
Normal file
28
oldstuff/map-mash/app/controllers/maps_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class MapsController < ApplicationController
|
||||
def index
|
||||
@maps = Map.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xml { render :xml => @maps }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@map = Map.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.png do
|
||||
GoogleMapLocationFetcher.new.fetch([@map.name]) do |loc,image|
|
||||
dest = Rails.root.join("public/maps/#{@map.id}.png")
|
||||
FileUtils.mkdir_p(File.dirname(dest))
|
||||
|
||||
File.open(dest, 'w') do |f|
|
||||
f.write(image)
|
||||
end
|
||||
send_file(dest, :type => 'image/png')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user