How often have you wasted time doing renames in rails? Sure it’s hard to automate everything without understanding the code, but there sure are a lot of mechanical steps that you can easily automate. Ryan and I took on controller renames and got a fair way in the few hours we spent on the night.
To rename a controller:
$ rails_refactor.rb rename OldController NewController
- renames controller file & class name in file
- renames controller spec file & class name in file
- renames view directory
- renames helper file & module name in file
- updates routes
To rename a controller action:
$ rails_refactor.rb rename DummyController.old_action new_action
- renames controller action in controller class file
- renames view files for all formats
Looking to extend it with model renames, and then more complex refactoring.
If you like it, please fork and contribute 🙂