It\'s been a very long time since I\'ve used ruby for things like this but, I forget how to open a file, look for a string, and print what ruby finds. Here is what I have:>
The simplest way to get the root is to do:
rake routes | grep root
If you want to do it in Ruby, I would go with:
File.open("config/routes.rb") do |f| f.each_line do |line| if line =~ /root/ puts "Found root: #{line}" end end end