adopt-a-hydrant/app/controllers/welcome_controller.rb

15 lines
440 B
Ruby
Raw Normal View History

2011-02-14 18:49:00 +00:00
class WelcomeController < ApplicationController
2011-02-25 21:34:01 +00:00
def index
2011-02-25 21:49:45 +00:00
@zoom = 15
2011-02-25 21:34:01 +00:00
# Default coordinates: Boston center
@lat, @lng = 42.358431, -71.059773
2011-02-25 21:49:45 +00:00
@hydrants = []
2011-02-25 21:34:01 +00:00
address, city, state = params[:address], params[:city], params[:state]
if address && city && state
@zoom = 18
2011-02-25 21:49:45 +00:00
@lat, @lng = Address.find_lat_lng("#{address}, #{city}, #{state}")
@hydrants = Hydrant.find_closest(@lat, @lng)
2011-02-25 21:34:01 +00:00
end
end
2011-02-14 18:49:00 +00:00
end