Blog An exploration of the art and
craft of software development

February 2008 Archives

ActiveRecord change_column

Posted by Marty Haught on Feb 23, 2008Comments

Yesterday I needed to perform a migration to change some of the attributes on a database column. Specifically we decided to add a default value and set a not null constraint on it. It was already defined and had important data in several databases. I wanted to do it in a ruby way but didn't feel that adding and removing a column was acceptable. I was hoping I didn't have to drop to native SQL to do an alter command. Luckily after a bit of searching through the API I stumbled across the change_column method in ActiveRecord. This was exactly wanted I needed but I had never heard it referenced before. I'm sure to many this is obvious and perhaps they've used it many times before. Since it may save some others some time, I'll just do a fast post about it. Here's an example of how we used it:

  def self.up
    change_column :my_table, :handling_fee, :decimal,  :precision => 5, :scale => 2, 
      :default => 0.0, :null => false

  def self.down
    change_column :my_table, :handling_fee, :decimal,  :precision => 5, :scale => 2


Latest ActiveWarehouse changes

Posted by Marty Haught on Feb 04, 2008Comments

The large render code refactoring has been checked into ActiveWarehouse’s trunk today. It took me a bit longer than I originally thought back around the new year to get all the changes in. However, I do believe it was worth it. I intend to do a new tutorial with the new approach to rendering but that won’t happen for another week or two. Instead I’ll give a short example to get you running.

Continue Reading…

MountainWest RubyConf 2008

Posted by Marty Haught on Feb 12, 2008Comments

I’m looking forward to this year’s MountainWest RubyConf in Salt Lake City on March 28-29. Mike and Pat have put together a great conference for very little money. Jim Weirich, Ezra Zygmuntowicz and Evan Phoenix will make out a stellar list of keynotes. The other presentations look interesting as well. I’ll be assisting this year as I did for 2007. If you’re looking for a nearby Ruby conference you should consider it. I know several of us in the Denver area will be making a roadtrip out of it.

Multitasking Cost

Posted by Marty Haught on Feb 26, 2008Comments

The subject of multitasking has come up in several books I’ve read recently as well as in a few conversations. Before this point I used to think multitasking was fairly harmless and potentially beneficial in some cases. I figured I was pretty good at it, being able to keep multiple threads going along in my head as I performed tasks. I’ve observed others that didn’t see to do this as well.

These recently discussions of multitasking have made me reconsider how harmful it can be, especially if you’re doing it all the time. Here’s a recent article from The Atlantic that discusses multitasking in more detail, including referencing several studies.

Continue Reading…

YUI 4 Rails - Release 0.0.1

Posted by Marty Haught on Feb 08, 2008Comments

Tonight I just pushed out the first release of the YUI 4 Rails plugin, version 0.0.1, built on YUI version 2.4.1. It’s not full featured but it does work and it seemed best to get it out there so at least some can use it. Specifically, the Active Warehouse trunk can use the datatable widget for sortable reports. However, it is possible to just use the plugin on its own.


First, you’ll want to get the plugin from RubyForge. You can either install it via the plugin command:

script/plugin install svn://

Or manually download the tar.gz/zip file and extract it into your RAILS_APP/vendor/plugins directory.

Continue Reading…