[TASK] Update to Rails 4.0.4.

Also update brakeman and fix sprockets to 2.11.0 to avoid failures
in the unit tests concerning the "environment" variable being not defined.