Ruby

Ruby Version Manager

I’ve been meaning to start using ruby1.9 but always stuck at maintaining codes in production that depends on Ruby1.8.6. Fortunately, there’s this thing called Ruby Version Manager where you easily change between different rails version. I have nothing but praise for the guys who made life easier for us programmers to do our job better & faster with RVM.

The only thing is you have to install your gems for each ruby version. It does make sense because there are quite a few gems that depends on different built. Installing gems are not that hard imho. So no issue there.

Now I can change between different ruby version as easy as this:

$ rvm 1.9.1 # For ruby 1.9.1

$ rvm 1.8.7

What’s excellent about this is the ruby version is sandbox in just that one terminal you’re using. It doesn’t interferes with your already *original ruby installation. * rvm calls is your ruby system. To revert back to your original ruby installation just do

$ rvm system

Or if you want to set a default ruby throughout your system. You can simply do so like this:

$ rvm 1.9.1 –default

If you haven’t tried it before, go try it. Don’t worry, it won’t mess up anything on your current ruby system

Ruby Version Manager – http://rvm.beginrescueend.com/

Updating Ruby on Ubuntu 8.04

Pheww.. all test pass after the latest ruby package updates from the ubuntu team.

I was a little worried reading the comments from the official Rails site. From the comments, a lot of people are experiencing problems after using the patch provided by the official Ruby team.

However, today I received an update notification on my Hardy that a package is available with the latest Ruby security updates. So I installed it and no problems accounted so far while testing my Rails2.1 app. Fortunately that the project I’m working on has a good test coverage. (I made sure of it too!)

Quote Phobia

I don’t get it why some people write this

%(Unverified email address. Please check your email for your activation code.)

instead of this

“Unverified email address. Please check your email for your activation code.”

Is it that hard to put those double quote?

to_proc or not to proc

Instead of writing this

Profile.find(:all).collect{ |x| x.email }

I could write this using Rails’ Symbol#to_proc

Profile.find(:all).collect(&:email)

Nice.

Ruby Cheatsheet Part Two!

Finally, part 2 of the Ruby Cheatsheet is now complete! Click here to download the file from Scribd, which, by the way, is also an excellent site for lots of stuff… so kudos to the Scribd crew…

Part two gets you acquainted with the built-in stuff ruby provides to make your coding life easier and more fun (or confusing maybe?). Great help for you young apprentices who are looking forward to becoming Jedi Railers… (Nothing like geek speak to lighten up your day)

Now, about that project wall….

UPDATE: The combined version, part 1 and part 2 together, can be found here. I’ve made some improvements to the file to make it more readable – Acap

Hello World

[sourcecode language='ruby']puts ‘Hello World’[/sourcecode]

Ruby Syntax Cheatsheet

For all us Ruby on Rails newbies, it’s really important to know Ruby, the language, before jumping into Rails. Learning Rails without knowing Ruby is like doing bike stunts without learning how to ride. Major pain bro…

Save yourselves from major cranial meltdown by learning Ruby syntax first. It shouldn’t be too hard if you already know other programming languages. To help us with learning it, we created our own Ruby Syntax Cheatsheet

This is part 1 of the Ruby Syntax Cheatsheet we made to help us code in Ruby. It’s based on the Ruby for Rails book by David Black. Highly recommended reading for all of us who aspire to become ‘Jedi’ Railers…. (hey, you can’t make Jedi if you don’t know the Force!). Click here to download the file