d834b81003
git-subtree-dir: map-mash git-subtree-mainline:eacc351b17
git-subtree-split:7f16409d12
29 lines
622 B
Ruby
29 lines
622 B
Ruby
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
|