Created
April 11, 2011 22:02
-
-
Save ordinz/914469 to your computer and use it in GitHub Desktop.
convert rails 2 routes to rails 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
controller = 'reports' | |
str = %{ | |
map.reports '/reports', :action => 'index' | |
map.reports_by_month '/reports/by_month', :action => 'by_month' | |
map.report_for_client '/reports/client/:id', :action => 'client' | |
} | |
scans=str.scan(/[a-z]+\.(\S+)\s+(\'.*\'),\s+:action\s+=>\s+'(.*)'/) | |
matches = scans.collect {|scan| "match #{scan[1]} => '#{controller}##{scan[2]}', :as => '#{scan[0]}'"}; nil | |
matches.each {|m| puts m }; nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment