Cleanup backported from rails4 branch

Look at the commit messages. It is a backport of the delayed pull request: https://github.com/crowbar/crowbar/pull/2029
Wrong indentation here?