Ricky Spanish Ricky Spanish - 7 months ago 77
Ruby Question

Rails: rename globalize column

The rails globalize gem docs are great, but I can't find a solution, what I have to do, when I want to rename a column.

Last Year I did that, to add the translation fields.

def up
remove_column :news, :name
News.add_translation_fields! name: :string

def down
add_column :news, :name, :string, default: nil
remove_column :news_translations, :name

Now I want to rename the column "name" to "title", without loosing my data and translations. How do I have to write the migration file?


Alter the column on the news translations table directly:

def change
  rename_column :news_translations, :name, :title