Skip to content

Instantly share code, notes, and snippets.

@wwwbruno
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save wwwbruno/4e07289a3ff9ad6173aa to your computer and use it in GitHub Desktop.

Select an option

Save wwwbruno/4e07289a3ff9ad6173aa to your computer and use it in GitHub Desktop.
# Reference https://github.com/globalize/globalize
# To create new records when using Globalize
# to enter in rails console
rails c
# set the locale to English
I18n.locale = :en
# create a new record with English locale
Affiliate.create(name: 'The big hotel', description: 'Sed non varius ex. Vivamus ac massa non eros dignissim tincidunt at nec est. Donec dapibus tempus lacus, eget cursus arcu fermentum et. Nulla fermentum quis dui sit amet tincidunt. Quisque at odio neque. Aenean augue ipsum, molestie et nunc sed, pharetra aliquam lorem.')
# set the locale to Portuguese
I18n.locale = :br
# Get the newest affiliate that we just create
affiliate = Affiliate.last
affiliate.update(name: 'O grande Hotel', description: 'Aqui vai um longo texto em português com a descrição do hotel')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment