I made a mistake early in development, and named one of my models with plural noun (Users
instead of User
). Is there an easy way to rename it and corresponding controller (similar to generating it with script/generate
way)?
update: this script is not supported anymore
A script exists that will do the job for you:
http://github.com/hiroshi/script-refactor
You'll have to change all the references to Users
in all your application manually.
To change the name by itself, it's not very hard : rename the file and add the following migration :
class RenameUsers < ActiveRecord::Migration
def self.up
rename_table :users, :user
end
def self.down
rename_table :user, :users
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With