Skip to content

Instantly share code, notes, and snippets.

@ipoval
Created January 28, 2016 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipoval/422456ab6c3c9a245c95 to your computer and use it in GitHub Desktop.
Save ipoval/422456ab6c3c9a245c95 to your computer and use it in GitHub Desktop.
rails_3_to_4_routes_changes.rb
nl -ba config/routes/api_v1.rb | grep -v via | grep match | awk '{print $1}' | pbcopy
a = [43, 46, 50, 51, 54, 55]
File.open('config/routes/api_v1.rb') do |f|
lines = f.readlines
lines.each_with_index do |line, idx|
if a.include?(idx + 1)
lines[idx] = line.sub('match', 'get')
lines[idx] = lines[idx].rstrip + ' # FIXME: rails4' + "\n"
end
end
puts lines
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment