Skip to content

Instantly share code, notes, and snippets.

View joelbiffin's full-sized avatar

Joel Biffin joelbiffin

  • Cleo
  • London, United Kingdom
View GitHub Profile
@joelbiffin
joelbiffin / .zshrc
Created February 3, 2023 10:37
Stock zshrc file for new mac setups
print-directory() {
echo ""
}
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export TERM="xterm-256color" CLICOLOR=1
export LESS_TERMCAP_mb=$(print -P "%F{cyan}") \

Decoupling Models from their V1 'after actions'

The idea would be to remove all the after_create / after_update hooks in our Active Record models and replace them with created_{ModelName} / updated_{ModelName} events containing the new model attributes.

For example

class User < ApplicationRecord