What are pros and cons for MacPorts, Fink and Homebrew? I'm just migrating from Ubuntu Linux to Mac, and everything is new and I'm re-learning a lot of stuff.

On Linux I had the excellent apt-get to manage software packages. I googled for an alternative on Mac and found about MacPorts, Fink and Homebrew.

I will use this computer primarily to develop Ruby on Rails applications.

So, what are the differences between them? Which are the upsides and downsides? Which one is best maintained and has more packages?
Definitely Homebrew. I started with Fink, then switched to MacPorts (happier), then Homebrew (much, much happier). These are my reasons for using each (a pro list if you will):
Fink

Apt-based - feel right at home if you come from a Debian-based environment

MacPorts

Unlike homebrew do not depend on MacOS library that may change in the future.
Install everything in /opt/local
Nice variants system that lets you customise the build
Easy and intuitive port files, also allows you to add your own
supports many versions of OSX and macos going back to Tiger including PowerPC versions see other answer

Homebrew

Maximum leveraging of what comes with OS X. Unlike Fink or MacPorts, it does not require you to build/install ruby and libraries from scratch just to install some small Ruby-based tool.
Installs into /usr/local
Install without root access
Every installed package is cleanly sandboxed into its own cellar so you don't have stray files all over your system, just symlinks from bin, man, etc.
Has guides and automation to create your own formula files (ie. package descriptors)
Written in ruby and all formulas are concise ruby scripts

pkgin

Everything installed in /opt/pkg/
backed by pkgsrc community and Joyent
Known to work on NetBSD, DragonFly BSD, Solaris, Debian, Mac OS X, Minix

https://pkgsrc.joyent.com/install-on-osx/
http://pkgin.net/