Thursday, December 15, 2005

Rails Migration Cheat Sheet

I've added a simple cheat sheet for Rails Database Migrations to my 'backpack'..
Rails Migration Cheat Sheet

Adding options to rake tasks

I've been wondering how to call a rake task and pass it arguments.... just found it:

the example is in the rails code source code (railties/lib/tasks/databases.rake) for migrations. Normally you just call 'rake migrate' to come up to the current version. But if you want to revert back to another database version, you would add "rake migrate VERSION=12" (or whatever version is appropriate).

A quick look at the rails codebase has the migrate task as:

task :migrate => :environment do
ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
Rake::Task[:db_schema_dump].invoke if ActiveRecord::Base.schema_format == :ruby

It uses
which is just accesses the environment.
So rake just uses the command line to set up environment variables. Good to know.

Wednesday, December 14, 2005

NEWSFLASH!!! ... Rails 1.0 is released! ... World Rejoices!

Rails has a fancy new frontpage, new screencasts, and lots of giddy developers.

David's Announcement

Wednesday, December 07, 2005

Ruby Book Sales Surpass Python

From the "What's Upcoming" Department:

I wish we could simply skip the annoying period of large companies dragging their feet on the adoption of Ruby as a post-Java language. Tim O'Reilly checked the numbers and found that Ruby books are up 1552% and now surpass Python.

This is important for people like me that waited a bit too long to switch from Java. I saw Python and Ruby both as good options and didn't fully jump into either. Learning a new language as a *primary language* is time and brain consuming enough that its not a lightweight matter. You learn to think in that language.

Luckily, with the popularity of Rails and the underlying "Zen Goodness" of Ruby, I'm hopefully optimistic that this stalemate will resolve itself on the side of Ruby. Don't get me wrong, I like Python, but to make inroads into the Post-Java World (ok, maybe the Alongside Java World) we need a good single contender.

Here's the O'Reilly Story:
Ruby Book Sales Surpass Python"

Saturday, December 03, 2005

Why Ruby is an acceptable Lisp

Eric Kidd has a very nice posting + discussion going on about Ruby in relation to Lisp. I frequently stare longingly at Lisp (and frolic now and again with the Little Schemer). My interest in Ruby (along with moving to Cambridge) have me thinking more and more about Lisp these days.

Eric thinks that Ruby's metaprogramming facilities give you power approaching macros - "80% of what you want from macros" - while the language syntax provides a "dense functional language", allowing the compact and clear description of the programming task. While I cringe a bit at the term 'dense' here, Ruby's expressive properties are formidable (something that I discuss briefly in a comment to the post itself).

The post is well worth reading, and the comments provide a nice range of opinion. Plus there are lots of yummy code snippets!