You can do it in 2 ways, if you do it from the database you will have to change it manually and then update it with rails db:schema:dump
.
To update your schema
, however, you will have to modify the models and controllers. If on the other hand you like to do it with a migration, you will first need to generate it with:
rails generate migration cambiando_columna
... and in the migration that I generate you put the following (it is wrong in rename_colum
, it is rename_column
):
class CambiandoColumna< ActiveRecord::Migration[5.0]
def change
rename_column :pagos, :ntrantes, :Entrantes
end
end
... and when you finish modifying this migration simply put the command rails db:migrate
for this change to take effect.