Skip to content

Instantly share code, notes, and snippets.

View sgoedecke's full-sized avatar

Sean Goedecke sgoedecke

View GitHub Profile
# frozen_string_literal: true
class PeopleHaveMiddleNames < ActiveRecord::Migration::Current
def self.up
add_column "people", "middle_name", :string
end
def self.down
remove_column "people", "middle_name"
end
# frozen_string_literal: true
module ActiveRecord
module Validations
class AbsenceValidator < ActiveModel::Validations::AbsenceValidator # :nodoc:
def validate_each(record, attribute, association_or_value)
if record.class._reflect_on_association(attribute)
association_or_value = Array.wrap(association_or_value).reject(&:marked_for_destruction?)
end
super
@sgoedecke
sgoedecke / rtes
Last active October 3, 2021 23:28
testd
@sgoedecke
sgoedecke / dotfiles
Last active September 3, 2021 02:36
--- stack
zsh, nvim, tmux
--- .vimrc
source ~/.vim/autoload/pathogen.vim
execute pathogen#infect()
call pathogen#helptags()
filetype indent plugin on
class StoredMethod
attr_accessor :result, :method, :args
def initialize(result, method, args)
@result = result
@method = method
@args = args
end
def execute(obj)
res = obj.send(@method, @args)