20170314000001_fixed_translation2.rb 743 B

123456789101112131415161718192021222324252627282930313233
  1. class FixedTranslation2 < ActiveRecord::Migration[4.2]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. settings_update = [
  6. {
  7. 'name' => 'http_type',
  8. 'title' => 'HTTP type',
  9. 'description' => 'Define the http protocol of your instance.',
  10. },
  11. ]
  12. settings_update.each do |setting|
  13. fetched_setting = Setting.find_by(name: setting['name'])
  14. next if !fetched_setting
  15. if setting['title']
  16. fetched_setting.title = setting['title']
  17. end
  18. if setting['description']
  19. fetched_setting.description = setting['description']
  20. end
  21. fetched_setting.save!
  22. end
  23. Translation.load
  24. end
  25. end