3

I'm working on a rails 4 app for which I need to change one of my model's names. This translates into changing a lot of other files such as the controller, view, etc.

I already generated a migration to change the table name. Then changed all owner to user inside all files within my app's directory using the global find and replace (i.e. ctrl+shift+F).

As a final step I only need to rename the file names as well for example the model from owner.rb to user.rb, owners_controller.rb to users_controller.rb, etc.

nowk
  • 32,822
  • 2
  • 35
  • 40
jimbog
  • 33
  • 4

1 Answers1

2

If you are using a linux system instead of using sublime you could use a terminal, change directories to your project root and use:

find . -name '*owner*' -exec bash -c 'mv $0 ${0/owner/user}' {} \;

I found this technique here :), cheers

find a pattern in files and rename them

Community
  • 1
  • 1
CoderDake
  • 1,497
  • 2
  • 15
  • 30