The guide Asset Pipeline Error Pages now no longer works, since non-digest assets aren't generated in newer Rails apps. To fix this, I've replaced the config/initializers/exceptions.rb
initializer that swaps out the middleware with the Rake task here, which will be run after Rails assets:precompile
task.
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
module Dependencies | |
# Ensure dependencies from the superclass are inherited by the subclass. | |
def inherited(subclass) | |
if superclass.respond_to?(:dependencies) | |
subclass.dependencies.concat dependencies | |
end | |
super | |
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
class MyRackApp | |
def initialize(app) | |
stack = Rack::Buidler | |
# stack.use … | |
stack.run app | |
@app = stack.to_app | |
end | |
def call(env) |
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
module Void | |
def void(method_name) | |
method = instance_method(method_name) | |
remove_method method_name | |
define_method(method_name) do |*args, &block| | |
method.bind(self).call(*args, &block).tap do |return_value| | |
raise TypeError, 'unexpected return value' unless return_value.nil? | |
end | |
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
# What I should have to do: | |
require 'active_model/validations' | |
# What I actually have to do: | |
require 'active_support/callbacks' | |
require 'active_support/concern' | |
require 'active_support/core_ext/module/delegation' | |
require 'active_model/callbacks' | |
require 'active_model/errors' | |
require 'active_model/naming' |
I hereby claim:
- I am tylerhunt on github.
- I am tylerhunt (https://keybase.io/tylerhunt) on keybase.
- I have a public key whose fingerprint is 9E14 9931 48C7 405F 4372 B2A5 ACAA 8C6F 2C0A A4C5
To claim this, I am signing this object:
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
require 'factory_girl' | |
class Simulator | |
def initialize(model, options={}, &block) | |
self.model = model | |
self.strategy = options.fetch(:strategy) { FactoryGirl::Strategy::Build } | |
self.factory = define(&block) | |
end | |
def build(overrides={}, &block) |
Start a Redis server with a limited number of clients:
$> /usr/local/opt/redis/bin/redis-server --port 6380 --maxclients 5
Then, run the script:
$> ruby redis_connection_pool.rb
The script should fail with the following error during the second iteration:
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
source 'https://rubygems.org/' | |
gem 'gemfury', '~> 0.4.20' |
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
source 'https://rubygems.org/' | |
gem 'capybara' | |
gem 'capybara-webkit' |