Sha256: f38670d108db86cb6413ea50e29728f84731d8e8637d845dd6564bacad530c10

Contents?: true

Size: 584 Bytes

Versions: 21

Compression:

Stored size: 584 Bytes

Contents

class ConvertTitlePrefixSetting < ActiveRecord::Migration
  class BareBlog < ActiveRecord::Base
    include BareMigration
    
    serialize :settings, Hash
  end

  def self.up
    BareBlog.find(:all).each do |b|
      if b.settings.has_key? "title_prefix"
        b.settings["title_prefix"] = (b.settings["title_prefix"] ? 1 : 0)
        b.save!
      end
    end
  end

  def self.down
    BareBlog.find(:all).each do |b|
      if b.settings.has_key? "title_prefix"
        b.settings["title_prefix"] = (b.settings["title_prefix"] == 1)
        b.save!
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
typo-5.5 db/migrate/061_convert_title_prefix_setting.rb
typo-5.4.4 db/migrate/061_convert_title_prefix_setting.rb
typo-5.4.3 db/migrate/061_convert_title_prefix_setting.rb
typo-5.4.2 db/migrate/061_convert_title_prefix_setting.rb
typo-5.4.1 db/migrate/061_convert_title_prefix_setting.rb
typo-5.4 db/migrate/061_convert_title_prefix_setting.rb
typo-4.1.1 db/migrate/061_convert_title_prefix_setting.rb
typo-5.0.2 db/migrate/061_convert_title_prefix_setting.rb
typo-4.1 db/migrate/061_convert_title_prefix_setting.rb
typo-5.0.1 db/migrate/061_convert_title_prefix_setting.rb
typo-5.0.3.98.1 db/migrate/061_convert_title_prefix_setting.rb
typo-5.0 db/migrate/061_convert_title_prefix_setting.rb
typo-5.0.3.98 db/migrate/061_convert_title_prefix_setting.rb
typo-5.1.1 db/migrate/061_convert_title_prefix_setting.rb
typo-5.1.2 db/migrate/061_convert_title_prefix_setting.rb
typo-5.1.3 db/migrate/061_convert_title_prefix_setting.rb
typo-5.1 db/migrate/061_convert_title_prefix_setting.rb
typo-5.1.98 db/migrate/061_convert_title_prefix_setting.rb
typo-5.2.98 db/migrate/061_convert_title_prefix_setting.rb
typo-5.2 db/migrate/061_convert_title_prefix_setting.rb