2005-01-20

Rails is smarter than you (or, at least me)

I'm going back through the Rails tutorial that I mentioned last post, only using PostgreSQL 8.0.0 instead of MySQL this time, and discovered something very, very nice about Rails.

The tutorial (for those of you who haven't gone through it—and if you haven't, you should; it won't take long, and I can wait—has you create a database table for storing items on a todo list. There's a column called "done" of type integer; 1 means "done" and 0 means "not done". My first time through the tutorial I followed these directions, but this time I made the "done" column of type boolean because, well, it makes more sense and PostgreSQL has that data type.

Before, Rails presented the edit field for the "done" value as a text field. This time, with a boolean behind it, Rails presented it as a select list from which "True" or "False" can be chosen. In other words, Rails is smart enough not only to detect the table columns for itself, it's smart enough to realize that the possible values are constrained and change the default UI to something more appropriate.

Now, one could argue that for a boolean not null column, the UI element should really be a checkbox, but that would be nitpicking.

2005-01-19

On the Rails!

I just completed my first Rails webapp, using the tutorial Making a todo list. I highly recommend this tutorial to anyone getting started with Rails—it's very well written. I wish the author had left his name somewhere in it so that I could pay proper respect, but this is gonna have to do.

Unfortunately, I can't show you my new Rails app, because links to localhost won't work. :-) It's running on my laptop, so I'll bring it to the next KCRUG meeting. Maybe by then I'll have more Rails to show off.

2005-01-17

What Languages Fix

An aside: from Paul Graham, a list of programming languages defined not by what they are or what they do, but by what problem with other programming languages it's supposed to fix.

2005-01-14

Instiki

I don't know how I've managed to not find out about Instiki before tonight. (That's not quite true. I do know. I'm woefully behind the curve when it comes to Ruby.)

For those of you even slower than me, Instiki is a wiki that runs on your local machine. (I don't suppose it's limited to just local users, but I don't know if it's designed to scale.) When launched, it goes to the background, listening on port 2500. Access is through a web browser (as you'd expect).

I've been thinking that it would be nice to have something like this for a while. This should be handy for keeping notes for myself and such.