How to get Ruby / Homebrew / RVM to work on Yosemite?

After installing Yosemite, I was unable to run brew or ruby. I was getting this error on brew update: /usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/