Skip to content

Instantly share code, notes, and snippets.

View samsongz's full-sized avatar
🏀
hoopin

Sam Meyer samsongz

🏀
hoopin
  • Santa Barbara, CA
View GitHub Profile
== 20160621200031 AddJsonColumnToExtractRecords: migrating ====================
-- add_column(:extract_records, :location_data, :jsonb)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedObject: ERROR: type "jsonb" does not exist
LINE 1: ALTER TABLE "extract_records" ADD "location_data" jsonb
^
: ALTER TABLE "extract_records" ADD "location_data" jsonb/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
@samsongz
samsongz / instructions.md
Last active November 12, 2015 17:42
Template file for generating Rails API applications for back end services. (Rails-API, Postgres, Rspec)

Purpose:

Quickly spin up back end Rails applications that to serve as an API. Use preferred configurations such as RSpec for testing, PostgreSQL for the database. Rails API gives us the benefits of Rails with minimal overhead.

How to:

  • Step 1: Install rails-api gem locally $ gem install rails-api
  • Step 2: Save rails-api-template.rb locally
  • Step 3: Create new application
@samsongz
samsongz / deploy.rb
Last active August 29, 2015 14:13
Deploy Promiscuous Subscriber
after "deploy:restart", "deploy:restart_subscriber"
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
cmd = "cd #{fetch(:latest_release)} && bundle exec #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}"
cmd += "['#{rake_args.join("','")}']" unless rake_args.empty?
run cmd
set :rakefile, nil if exists?(:rakefile)
end