This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- stack | |
zsh, nvim, tmux | |
--- .vimrc | |
source ~/.vim/autoload/pathogen.vim | |
execute pathogen#infect() | |
call pathogen#helptags() | |
filetype indent plugin on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
NewerOlder