]> git.openstreetmap.org Git - rails.git/blob - db/migrate/20161011010929_subscribe_authors_to_diary_entries.rb
Use rails 4.2 defaults for older migrations
[rails.git] / db / migrate / 20161011010929_subscribe_authors_to_diary_entries.rb
1 class SubscribeAuthorsToDiaryEntries < ActiveRecord::Migration[4.2]
2   def up
3     DiaryEntry.find_each do |diary_entry|
4       diary_entry.subscriptions.create(:user => diary_entry.user) unless diary_entry.subscribers.exists?(diary_entry.user.id)
5     end
6   end
7
8   def down; end
9 end