cirandas.net

ref: master

db/migrate/20150513213939_update_topic_creation_configuration.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class UpdateTopicCreationConfiguration < ActiveRecord::Migration
  def up
    Forum.where("setting LIKE '%:allows_members_to_create_topics: true%'").find_each do |forum|
      forum.setting.delete(:allows_members_to_create_topics)
      forum.setting.merge!(:topic_creation => 'related')
      forum.save
    end
  end

  def down
     say "this migration can't be reverted"
  end
end