2014年4月29日 星期二

gmaps4rails

http://www.techques.com/question/1-10803209/Gmaps4Rails-Custom-InfoWindow

http://apneadiving.github.io/

https://www.youtube.com/watch?v=R0l-7en3dUw&feature=youtu.be


http://rubydoc.info/gems/gmaps4rails/2.0.0/Gmaps4rails/MarkersBuilder

rails note-- github ignore


if the file you want it to be ignored has already on github, you need to remove it from github first and add it to .ignore file then syn it.

2014年4月27日 星期日

rails heroku setting

 git push heroku master
heroku run rake db:migrate
heroku restart
heroku open
heroku logs
heroku config
heroku run rails console
s3 setting:
https://devcenter.heroku.com/articles/s3

reset database on heroku:
heroku pg:reset DATABASE_URL
heroku run rake db:migrate

rails geocode

http://eureka.ykyuen.info/2011/04/08/rails-implementation-of-geocoder-on-model/
1. Add latitudelongitude and address to the User model
  • rails generate migration AddLatitudeAndLongitudeAndAddressToUser latitude:float longitude:float address:string

2. Run the migration
  • rake db:migrate

3. Add the following lines in app/model/user.rb

1
2
geocoded_by :address
after_validation :geocode
4. Try how Geocoder works in Rails Console
1
2
3
4
5
6
7
8
9
10
11
# Get the first user
user = User.first
# Set the user address field
user.address = "Hong Kong"
# Generate the user latitude and longitude
user.geocode
# Check the user latitude and longitude
user.latitude.to_s + " " + user.longitude.to_s



http://www.synbioz.com/blog/search_by_location_with_geocoder



location_info = request.location

@locations = Location.near([location_info.latitude, location_info.longitude], radius_distance_you_want_to_include)




rails mailgun setting



http://yhagio.github.io/blog/2013/06/07/mailgun-setting/


2014年4月16日 星期三

rails 4 Loading mixed (insecure) display content on a secure page




because you have one or more http urls in a secure page (https)

change all of those http urls to https will solve the problem.


rails 4 precompile things


if you add something to assets, do this !!
do this after change things needs to be precompile
bundle exec rake assets:precompile RAILS_ENV=production


http://stackoverflow.com/questions/7464544/ruby-on-rails-rake-assetsprecompile-error