Instructions:
- Setup rails:
- rails new app-name
- rails new app-name -T (if going to use rSpec)
- Update
Gemfile
- Run
Bundle install --without production
- Create
Guardfile
- Run
rails generate rspec:install
- Update
spec/rails_helper.rb
# app/jobs/cron_job.rb | |
class CronJob < Que::Job | |
# To minimize log clutter from unavailable jobs, | |
# @run_at should be a bit less than Que.wake_interval | |
@run_at = proc { 59.seconds.from_now } | |
def run | |
# Do stuff here | |
Instructions:
Gemfile
Bundle install --without production
Guardfile
rails generate rspec:install
spec/rails_helper.rb
{ | |
"Version": "YYYY-MM-DD", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "s3:*", | |
"Resource": [ | |
"arn:aws:s3:::BUCKET_NAME", | |
"arn:aws:s3:::BUCKET_NAME/*" | |
] |
Connection String | |
mysql://USERNAME:PASSWORD@HOST/DATABASE | |
Command line where FILENAME is file with data to be imported (filename.sql). | |
mysql -u USERNAME -pPASSWORD -h HOST DATABASE < FILENAME > import.log |
heroku pg:backups:capture | |
heroku pg:backups:download | |
pg_restore --verbose --clean --no-acl --no-owner -U ubuntu -d app_development latest.dump |
# 1. Delete everything except the hidden .c9 folder | |
# 2. Setup aliases | |
# Setup Postgres database | |
sudo service postgresql start | |
sudo sudo -u postgres psql | |
CREATE USER username SUPERUSER PASSWORD 'password'; | |
\q | |
echo "export USERNAME=username" >> ~/.profile | |
echo "export PASSWORD=password" >> ~/.profile | |
. ~/.profile |
Notes for those who are reading this:
// The below must be included somewhere in in .js.erb file. | |
... | |
$('#bootstrap-flash').html("<%= j (bootstrap_flash) %>"); | |
... |
Rails.application.eager_load! | |
ActiveRecord::Base.descendants.map { |m| ActiveRecord::Base.connection.reset_pk_sequence!(m.table_name) } |