#WDI Week 5 Notes
##Monday
###Bootstrap
##Tuesday
###Deployment
add to gemfile
gem 'rails_12factor', :group => :production
bundle
heroku run rake db:migrate
heroku run rake db:seed
git push heroku master
heroku pg:info shows the database
###Geocoding
require this gem in your rails app
gem 'geocoder'
bundle
in the rails console
Geocoder.search "56 York Street Sydney"
address = Geocoder.search "56 York Street Sydney"
address.first.latitude
address.first.longitude
if we paste those coordinates into google it will return a map
in places folder,
rails generate scaffold location name:text address:text latitude:float longitude:float
add this to the class
class Location < ActiveRecord::Base geocoded_by :address after_validation :geocode end
now whenever we enter an address, it wil give us the lat and long
whats my ip address
Geocoder.search '202.171.181.44' will return location based on the ip address
https://developers.google.com/maps/documentation/embed/start
register
google api console
turn on Google Maps Embed API
api access
take api key
paste the api key to generate the map
substituted the following in the iframe to make it dynamic
<iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/view?zoom=16¢er=<%[email protected]%>%2C<%[email protected]%>&key=AIzaSyBTqWAvl9DDiewoanjO5KVKCzwMmzh3Xmo"></iframe>
<iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/view?zoom=16¢er=-33.8679%2C151.2059&key=AIzaSyBTqWAvl9DDiewoanjO5KVKCzwMmzh3Xmo"></iframe>
Geocoder screencast:
http://railscasts.com/episodes/273-geocoder
##Wednesday
###Image uploads
##Thursday
##Friday
###Project 1 presentations