Menu

Articles about Ruby

Yesterday I decided to give Phusion Passenger aka mod_rails a try and installed it. It was dead simple to set it up and to deploy rails applications with it. I’m now using it for several “small” applications, for which the whole overhead of setting up a cluster of mongrels and a proxy doesn’t seem to be adequate. I’ll give you a short summary on how to install mod_rails for apache2 on Debian Etch.

Read more

Andreas Wolff recently released RSpactor, a (up to now) command line tool similar to autotest. Nevertheless it differs from autotest in two points. First it’s focused on RSpec and secondly it’s using Mac OS’ FSEvents to monitor file changes. According to this it only runs on Mac OS. To get it running on Linux you’ll have to change RSpactor’s Listener class to use Linux’ equivalent to FSEvents called...

Read more

By default it’s not possible to use a database-column called type for anything else than single table inheritance. To change this, simply use set_inheritance_column() and read_attribute():

class TypeTest < ActiveRecord::Base
  set_inheritance_column(:something_else)

  def type
    read_attribute(:type)
  end

  def type=(value)
    write_attribute(:type, value)
  end
end
Read more

I needed a way to get a list of the subclasses that inherit a specific. Unfortunately there is no method like Class.subclasses (there is Class.superclass, though) so I had to look for another way to achieve this. Let’s say, we want to have an array containing all subclasses as a class variable of our superclass Strategy. In order to fill the array we’ll overwrite the inherited class method of Class.

Read more