Ruby: Insecure world writeable dir in PATH

I faced this error message when I ran rails or bundle:
/Users/XXX/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler.rb:284: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

After short research I found the reason for this issue. /usr/bin/local was addded to $PATH and changed to be writable. I think I made the mistake and changed it to world because of an homebrew issue.
The solution for this is the following command (requires root):

chmod go-w /usr/local/bin

Source: http://stackoverflow.com/a/5395932