I had some problems with Ruby on rails while working in the Bullet on rails framework. Regexp.new("(class [^$]+)$", Regexp::MULTILINE) will basically match your whole file until the end. Regexp.new("(class [^\n]+)", Regexp::MULTILINE) will match only the line that starts with "class". Also, if you have problems with JavaScript, try doing rake rails:update:javascript.
A blog about real-world software engineering and development problems and solutions.