In your command-line run the following commands:
brew doctor
brew update
In your command-line run the following commands:
brew doctor
brew update
**/node_modules
prettier --write "**/*.js"
*Don't forget the quotes.# 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 |
class API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
# first we create an empty ActiveRecord::Relation object | |
relation = Model.where(attribute: value) | |
# then we make the relation stub the :[] method | |
# and return whatever values we need | |
relation.stub(:[]).and_return( Model.new({attrs: values})] ) | |
# of course, we can make this too | |
# instead of the step above | |
record = double("Model", :foo => 'bar', :bar => 'baz') |
require "active_record" | |
namespace :db do | |
db_config = YAML::load(File.open('config/database.yml')) | |
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
desc "Create the database" | |
task :create do | |
ActiveRecord::Base.establish_connection(db_config_admin) |
module Clipboard | |
def pbcopy(data) | |
IO.popen('pbcopy', 'w') {|io| io.write(data)} | |
end | |
def pbpaste | |
IO.popen('pbpaste', 'r').read | |
end | |
end |