cirandas.net

ref: master

db/migrate/20110728173905_add_more_trusted_sites_for_environments.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
class AddMoreTrustedSitesForEnvironments < ActiveRecord::Migration
  def self.up
    default_sites = Environment.new.trusted_sites_for_iframe
    Environment.all.each do |env|
      env.trusted_sites_for_iframe += default_sites
      env.trusted_sites_for_iframe.uniq!
      env.save_without_validation
    end
  end

  def self.down
    say 'Warning: This migration cant recover old data'
  end
end