Rails 2.0 regex to convert old Migrations

Rails 2.0 is here! I’m going to try to move the app I’ve been working on (at DesignHammer) over to take advantage of it. Doesn’t seem like it should take that long? But we’ll see ;–)

While getting started on that I wanted to try the new method for Active Record DB migrations. So I decided to rewrite all my old migrations (or at least the ones adding tables). I ended up crafting this regex to allow for a quick find and replace of the old style to be like the new style:

Find:

\.column\s+(("\w+")|(\:\w+))\s*,\s+(\:(\w+))

Replace:

.$5 $1
Posted
 

Why make yet another Rails date picker plugin!

Well for starters I have always been a huge fan of the Unobtrusive Date-Picker Widgit and there was no existing plugin for it. But then since it’s so unobtrusive why not just use the built-in methods to use it? Well because it relies on a class on the year (and not the other selects) and a very specific structure to the IDs for the <select> tags, and doing this with the existing helpers was not possible. And thus the plugin was born!

The idea from the beginning was to make very nearly identical in usage and in output to the built-in commands so as to make it as much of a drop-in replacement as possible. I also wanted to use the 12 hour time standard since most of us don’t go by a 24 hour clock. Thus similar or identical options are available, and the output will be almost identical to that made by the built-in commands, it will of course work with a form builder and take data from a passed in model object to set the selected options. In other words all the Rails goodness one expects!

Posted
 

Rails Date-Picker Plugin and raleigh.rb Hack Night

I just put up my first Rails Plugin. It’s for creating a date and date-time pickers in forms, that use the wonderful Unobtrusive Javascript Date-Picker Widget to allow the picking of dates via a nifty pop-up calendar.
I put the finishing touches on it tonight at the Raleigh Ruby Brigade Hack Night. I ♥ local Ruby community!

The meetup in general was nice, it was my first one. There were some recruiters that came at the beginning to say hi and also that they had no Ruby or Rails jobs to offer. There was discussion of favorite text editors that actually didn’t become a fight and some brief Mac-talk.

Hopefully I’ll get time to go again after Lillia arrives!

Posted
 

Mongrel Output Compression Handler Gem

After a little bit of hacking I've got a basic Mongrel plugin together to handle gziping and deflating a HTTP response body if a client accepts it and if activated in a Mongrel config script. It's based closely on the plugins I mentioned in [my earlier post](/2007/12/03/mongrel-and-http-output-compression/). It's probably not production ready (although I haven't found any immediate or glaring problems with it so far), and it desperately needs some tests written. But other than that it's good to go! It can be found as at [http://rubyforge.org/projects/mongrel-compres/](http://rubyforge.org/projects/mongrel-compres/ "RubyForge: Mongrel Output Compression Handler: Project Info").
Posted
 

Mongrel and HTTP Output Compression

After a little bit of hacking I’ve got a basic Mongrel plugin together to handle gziping and deflating a HTTP response body if a client accepts it and if activated in a Mongrel config script.
It’s based closely on the plugins I mentioned in my earlier post.

It’s probably not production ready (although I haven’t found any immediate or glaring problems with it so far), and it desperately needs some tests written. But other than that it’s good to go!

It can be found as at http://rubyforge.org/projects/mongrel-compres/.

Posted