Renaming .rhtml to .erb using Ruby

March 4, 2007 code 1 min read

Even though Rails isn’t dropping support for .rhtml in favor of .erb for a while, it doesn’t hurt to switch now (if you’re using edge Rails).

After a brief, thoughtless, moment of typing svn mv file.rhtml file.erb a couple of times, it donned on me that I’m not a monkey.

Dir.glob('app/views/**/*.rhtml').each do |file|
  puts `svn mv #{file} #{file.gsub(/\.rhtml$/, '.erb')}`
This content is open source. Suggest Improvements.


avatar of Brandon Keepers I am Brandon Keepers, and I work at GitHub on making Open Source more approachable, effective, and ubiquitous. I tend to think like an engineer, work like an artist, dream like an astronaut, love like a human, and sleep like a baby.