Tag Archives: rails

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

Posted in rails | Tagged , , , | Leave a comment

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

Posted in rails | Tagged , , , | 1 Comment

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

Posted in Uncategorized | Tagged , , , | Leave a comment

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

Posted in rails | Tagged , | 1 Comment

How to test a gem that changes ActiveRecord

The code given here comes from my gem, safe_attributes, which can be retrieved from https://github.com/bjones/safe_attributes. Some of the code for setting up this testing environment originally came from or was inspired by octopus, which is also available on github. The … Continue reading

Posted in rails | Tagged , , | 2 Comments

Using rescue_from in Rails controllers

I deal with a lot of old Rails code, and one of the things that has been bugging me recently is the use of rescue_action_in_public. It’s not incredibly flexible if you want to actually handle specific exceptions in a given … Continue reading

Posted in Exception Handling | Tagged , | Leave a comment