The problem start playing with rails is that most tutorial out there are based on rails 1.2.6 and doesn't work in rails 2 which is now the standard in debian lenny.

First install ruby and rubygem from debian packages.

Then install rails 1.2.6 in a local writable directory (ex. /home/mygemstuff)

gem install rails --version=1.2.6 --include-dependencies --install-dir /home/mygemstuff

Then we have to make some adjustment to the op-system. As root we link /var/lib/gems/1.8 to out /home/mygemstuff. Then we make rails and rake executable in out path.

cd /var/lib/gems/
rmdir 1.8
ln -s /home/mygemstuff 1.8

If in your path thare is /usr/local/bin than you can simply

cd /usr/local/bin
ln -s /home/mygemstuff/bin/rails
ln -s /home/mygemstuff/bin/rake

now you can do rails demo

and start to playing with it.