Skip to content

Instantly share code, notes, and snippets.

@stevenharman
stevenharman / 00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Last active March 11, 2024 04:11
Heroku Release Phase script for managing Rails DB migrations, and playing nice with Review Apps and postdeploy scripts

Heroku Release Phase + Review Apps + Rails

This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps. Further, this particular set up plays nicely with Heroku Review Apps in that the release phase script will:

  1. Fail, loudly, if the DB does not yet exist.
  2. Load the DB schema if the current schema version (as determined by bin/rails db:version) is 0.
  3. Run DB migrations otherwise.

For a "normal" app that usually means it will run the DB migrations.

@chrisbloom7
chrisbloom7 / change.rb
Last active September 10, 2019 11:40
Dynamic enum field values in nested association forms in Rails Admin
# app/models/change.rb
class Change < ActiveRecord::Base
belongs_to :changeset, inverse_of: :changed_fields
validates :changeset, presence: true, associated: true
validates :field, presence: true, uniqueness: {scope: :changeset_id}, inclusion: { in: :field_enum }
def field_enum
if changeset.try(:model).present?
changeset.model_attributes
else
@JunichiIto
JunichiIto / alias_matchers.md
Last active April 16, 2024 16:18
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value