openstreetmap-website/lib/tasks/subscribe_diary_authors.rb
Tom Hughes 826b70fdc5 Replace migrations that rely on models with rake tasks
Replace some migrations that rely on relationships between
models to add subscriptions with rake tasks.
2019-07-17 18:55:15 +01:00

7 lines
254 B
Ruby

namespace :db do
task :subscribe_diary_authors => :environment do
DiaryEntry.find_each do |diary_entry|
diary_entry.subscriptions.create(:user => diary_entry.user) unless diary_entry.subscribers.exists?(diary_entry.user.id)
end
end
end