051_fix_canonical_server_url.rb
上传用户:netsea168
上传日期:2022-07-22
资源大小:4652k
文件大小:0k
源码类别:

Ajax

开发平台:

Others

  1. class FixCanonicalServerUrl < ActiveRecord::Migration
  2.   class Blog < ActiveRecord::Base
  3.     include BareMigration
  4.     serialize :settings, Hash
  5.   end
  6.   def self.up
  7.     unless $schema_generator
  8.       Blog.find(:all).each do |b|
  9.         b.settings['canonical_server_url'] = b.settings['canonical_server_url'].to_s.gsub(%r{/$},'')
  10.         b.save
  11.       end
  12.     end
  13.   end
  14.   def self.down
  15.   end
  16. end