break out author subscriptions to its own migration
This commit is contained in:
parent
6b7ebf6dc4
commit
43ef60b6d5
2 changed files with 10 additions and 8 deletions
|
@ -9,12 +9,4 @@ class AddJoinTableBetweenUsersAndDiaryEntries < ActiveRecord::Migration
|
|||
add_index :diary_entry_subscriptions, [:diary_entry_id]
|
||||
end
|
||||
|
||||
def up
|
||||
DiaryEntry.find_each do |diary_entry|
|
||||
diary_entry.subscriptions.create(:user => diary_entry.user) unless diary_entry.subscribers.exists?(@user.id)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class SubscribeAuthorsToDiaryEntries < ActiveRecord::Migration
|
||||
def up
|
||||
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
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue