- Make sure your project is a git repo.
- Run
heroku loginin terminal. - Run
heroku create. * This will create a new app in your account, with a super epic name. - Push your app to Heroku
*
git push heroku master*heroku run bundle exec rake db:migrateto run your migrations on heroku
Gotchas:
- Make sure you're using Postgres. Heroku doesn't support SQLite3.
config.initialize_on_precompile = falsein config/application.rbruby '2.1.1'in your Gemfile- If you don't have the
herokuterminal command, install the Heroku Toolbelt - If you change your super epic default app name on Heroku, you also have to change your git URI.
-
Paperclip makes it easy to manage file attachments to models. * Many storage options. Use S3 on AWS for Heroku. See:
- Gemfile:
gem 'paperclip'&gem 'aws-sdk' - config/application.rb
- app/models/user.rb
- app/views/users/new.html.erb & app/views/users/show.html.erb * Gotchas:
- Make sure you make your S3 bucket in the US Standard region.
- Put this on the form that submits the file:
enctype=multipart/form-data - DONT GIT COMMIT YOUR AWS KEYS!
- Gemfile:
-
Figaro makes it easy to keep your private keys.. private. 1.
gem 'figaro'2.rails generate figaro:install3. Edit config/application.yml 4.rake figaro:herokuto push up your keys to Heroku.
3. Omniauth & Oauth-Facebook (Wed 4/23)
- Files to look at: * Gemfile * config/initializers/omniauth.rb * app/views/layouts/application.html.erb * config/routes.rb * app/controllers/sessions_controller.rb
- Flow
1. User get to your app and hits a link to 'Login w/fb'
- Sends them to /auth/facebook, which gets intercepted by omniauth gem. 2. This redirects them to facebook, where they authorize your app. 3. Facebook redirects to your app (to /auth/facebook/callback) 4. You handle the redirect in some controller action.
- You'll probably grab a user from the db or create one from the info in
request.env['omniauth.auth']
- Gotchas
* Make sure you create your app on www.developers.facebook.com
- Whitelist your redirect URI in Settings > Valid Oauth redirect URIs * Have a route in routes.rb for auth/facebook/callback