July 23, 2014 — kyle.huynh205
Rename database column name for table in Rails
First of all, run this command with oldname is the attribute that you like to change and newname is the attribute you like to replace
rails g migration change_oldname_to_newname
Look for the file ….. in ….. and modify like the following
class change_oldname_to_newname <ActiveRecord::Migration
def change rename_column :table_name,:old_column,:new_column end
end
Save the changes and update these change by running this comand
rake db:migrate
Those steps will do the steps.