Skip to content

Instantly share code, notes, and snippets.

@dvodvo
Created November 5, 2021 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvodvo/4af67f3015049d848889026c9c84a37c to your computer and use it in GitHub Desktop.
Save dvodvo/4af67f3015049d848889026c9c84a37c to your computer and use it in GitHub Desktop.
Mobility gem, migrating existing values to key-value table
Assuming Mobility is already configured. if one wishes to properly synch up and migrate existing values from the class table attribute to the default locale
following example with attributes `description_short, description_long, description_search` and default_locale `de`
@articles.all each do |article|
article.update(description_short_de: article[:description_short], description_long_de: article[:description_long], description_search_de: article[:description_search])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment