Rails snippet: require app files only once

16 05 2008

Ruby’s Kernel.require method will re-require the same source file if you pass it differing arguments that point to the same file. It doesn’t use File.expand_path to make sure it hasn’t already loaded the same file before. This can cause problems if you’re using constants or doing one-time initialization in a source file that’s getting loaded multiple times for one reason; you’ll need to add a wrapper that prevents re-entry.

If this annoys you as much as it does me (why should my application code include workarounds for what I regard to be a Ruby bug?), add this snippet to your config/environment.rb (pre Rails 2.0) or config/preinitializer.rb (Rails 2.0 or later).
Read the rest of this entry »



Why mod_rails is great for light-duty Rails apps

14 04 2008

The Ruby on Rails story is usually presented to the new developer as a wonderful break from tradition that makes a developer’s life so much better than the frameworks of the past. The clattering of skeletons in the closet you’re hearing? Well, that’s because it makes the sysadmin’s life much worse than PHP or Java. That just improved on Friday, with the release of mod_rails. If you’re looking for a way to do shared (or low traffic) hosting of Rails applications, this is for you.
Read the rest of this entry »



Acts_as_tsearch adjustments needed for PostgreSQL 8.3rc2

24 01 2008

Just a quick note: acts_as_tsearch needs some guidance to work with PostgreSQL 8.3 due to changes in tsearch2 integration.
Read the rest of this entry »



Leopard Upgrade Report: Mo’ Features, Mo’ Problems

27 12 2007

(Apologies to The Notorious B.I.G. for the title.)

I upgraded to Mac OS X 10.5 “Leopard” recently. In short, it’s not ready for mainstream use. There are a few nice improvements, but these are balanced by numerous problems that make me wish I had waited until, say, June 2008 or so. If you haven’t upgraded and aren’t sure that you need to, I suggest that you wait a few months, until some of the bugs have been worked out.
Read the rest of this entry »



Capacity vs. Scalability

13 11 2007

In I still don’t get the fascination with Ruby on Rails, Andy Davidson writes:
Scaling does not mean “Allows you to throw money at the problem”, it means “Can deal with workload”. He goes on to recommend mod_perl instead of Rails.

I’m not interested whether he likes Rails or not. Lots of people hate Rails, and I don’t care. I’m not going to make a big deal about the fact that he’s comparing a runtime architecture (Apache + mod_perl) with a framework (Ruby on Rails).

Those are insignificant compared to his claim that scalability means “Can deal with workload”. Actually, that’s a description of capacity.
Read the rest of this entry »