Reputation: 33
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.
Upvotes: 3
Views: 1318
Reputation: 1547
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
Upvotes: 2