| # The following comments fill some of the gaps in Solargraph's understanding of | |
| # Rails apps. Since they're all in YARD, they get mapped in Solargraph but | |
| # ignored at runtime. | |
| # | |
| # You can put this file anywhere in the project, as long as it gets included in | |
| # the workspace maps. It's recommended that you keep it in a standalone file | |
| # instead of pasting it into an existing one. | |
| # | |
| # @!parse | |
| # class ActionController::Base | 
| # frozen_string_literal: true | |
| class AssociationLoader < GraphQL::Batch::Loader | |
| attr_reader :klass, :association | |
| def initialize(klass, association) | |
| raise ArgumentError, "association to load must be a symbol (got #{association.inspect})" unless association.is_a?(Symbol) | |
| raise ArgumentError, "cannot load associations for class #{klass.name}" unless klass < ActiveRecord::Base | |
| raise TypeError, "association #{association} does not exist on #{klass.name}" unless klass.reflect_on_association(association) | |
| @klass = klass | 
This script will pull down an S3 remote configuration before running any terraform actions. Assumes the following structure:
main.tf
terraform.cfg
env/dev/vars
env/staging/vars
env/whatever/vars
env/whatever/somefile.tf
This installs a patched ruby 1.9.3-p374 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.
This is a little trick I use to spin up the packages instalation on Debian/Ubuntu boxes in Vagrant.
I add a simple function that checks if a directory named something similar to ~/.vagrant.d/cache/apt/opscode-ubuntu-12.04/partial (it may have another path in Windows or MacOS) and create the directory if it doesn't already exist.
def local_cache(box_name)
  cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),
                        'cache',
                        'apt',
                        box_name)| module ActiveRecord | |
| module ConnectionAdapters | |
| module DatabaseStatements | |
| # | |
| # Run the normal transaction method; when it's done, check to see if there | |
| # is exactly one open transaction. If so, that's the transactional | |
| # fixtures transaction; from the model's standpoint, the completed | |
| # transaction is the real deal. Send commit callbacks to models. | |
| # | |
| # If the transaction block raises a Rollback, we need to know, so we don't |