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 User < ActiveRecord::Base | |
has_one :subscription, dependent: :destroy | |
end | |
class Subscription < ActiveRecord::Base | |
acts_as_paranoid | |
belongs_to :user | |
enum plan: ServicePlans.plan_names |
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
# RSpec matcher for validates_with. | |
# https://gist.github.com/2032846 | |
# Usage: | |
# | |
# describe User do | |
# it { should validate_with CustomValidator } | |
# end | |
RSpec::Matchers.define :validate_with do |expected_validator, options| | |
match do |subject| | |
@validator = subject.class.validators.find do |validator| |
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
export_alias() { | |
local name=$1 | |
local alias_dir=$PWD/.direnv/aliases | |
mkdir -p "$alias_dir" | |
PATH_add "$alias_dir" | |
local target="$alias_dir/$name" | |
if declare -f "$name" >/dev/null; then | |
echo "#!/usr/bin/env bash" > "$target" | |
declare -f "$name" >> "$target" 2>/dev/null | |
echo "$@" >> "$target" |
OlderNewer