-
Recent Posts
Recent Comments
Archives
Categories
Meta
Author Archives: Brian Jones
Monitoring Rails with statsd and graphite
Assuming you’ve googled this topic at all, you are bound to have come across this article from 37signals, pssst-your-rails-application-has-a-secret-to-tell-you. You can basically build an initializer doing all the things in that post to get started sending data to statsd. Statsd … Continue reading
Ruby connection pooling made easy
If you ever want to have a connection pool, you need not reinvent the wheel because Mike Perham has done all the work for you already. Browse on over to connection_pool on github.
Write your own custom RSpec formatter
Earlier this year I spent some time writing a custom RSpec formatter. The purpose in my case was to be able to automatically update a remote service with the results of testing some code. You can find that project here, … Continue reading
Ruby’s Singleton and Custom Rails Application Configuration
A relatively simple way to load some configuration once and safely, is through the use of the Singleton module provided with Ruby. Accessing the instance is easy, call FooConfig.instance. This method is also thread-safe so no two threads are going … Continue reading
Require a Gemfile from a Gemfile
It is probably best I don’t bother explaining how or why I ended up wanting to reference an existing Gemfile from another Gemfile, but suffice to say it is something I sort of needed to do. After a bit of … Continue reading
Ruby segfault with net/http and openssl
I was attempting to push a new gem this evening and ruby 1.9.3 segfaulted. The dump indicated openssl and net/http as the issue. Pushing gem to https://rubygems.org… /Users/bjones/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault After a bit of googling I found a nice … Continue reading
Updated safe_attributes now works with devise
After getting someone interested in using devise with safe_attributes to post a little information on the issue to github, I investigated and found something new. The model validators in ActiveRecord can be used on things other than attributes of the … Continue reading
Rails + Kaminari with RSpec
The default rspec view specs don’t work so well for index pages if you have added Kaminari pagination. The reason is the assigned variable in the controller is not an array, but is instead expected to respond to additional methods: … Continue reading
Rails + Devise and Rspec
So I tried using Devise on a project and ran into an issue with the default generated controller specs. PlansController POST create with invalid params re-renders the ‘new’ template Failure/Error: response.should render_template(“new”) expecting <”new”> but rendering with <”"> # ./plans_controller_spec.rb:73:in … Continue reading
Test a gem with the Rails 3 stack
My previous post covers testing a gem that makes some change to how ActiveRecord works. But what if you want to test a gem that supplies some new behavior to another part of rails, like say ActionController. How do you … Continue reading