]> git.openstreetmap.org Git - rails.git/blob - db/migrate/20150111192335_subscribe_old_changesets.rb
Use reports_count so that counter_cache works automatically.
[rails.git] / db / migrate / 20150111192335_subscribe_old_changesets.rb
1 class SubscribeOldChangesets < ActiveRecord::Migration
2   def up
3     Changeset.find_each do |changeset|
4       changeset.subscribers << changeset.user unless changeset.subscribers.exists?(changeset.user.id)
5     end
6   end
7
8   def down; end
9 end