]> git.openstreetmap.org Git - rails.git/blob - db/migrate/20150111192335_subscribe_old_changesets.rb
Avoid more models in old migrations
[rails.git] / db / migrate / 20150111192335_subscribe_old_changesets.rb
1 class SubscribeOldChangesets < ActiveRecord::Migration[4.2]
2   class Changeset < ActiveRecord::Base
3   end
4
5   def up
6     Changeset.find_each do |changeset|
7       changeset.subscribers << changeset.user unless changeset.subscribers.exists?(changeset.user.id)
8     end
9   end
10
11   def down; end
12 end