"Fossies" - the Fresh Open Source Software Archive

Member "db/migrate/20170314000001_fixed_translation2.rb" (25 Mar 2021, 743 Bytes) of package /linux/www/zammad-4.0.0.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "20170314000001_fixed_translation2.rb": 3.4.1_vs_3.5.0.

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