DB: Integridade referencial

This commit is contained in:
2008-03-06 05:43:56 -03:00
parent e5bc6024ba
commit c58684c31c
12 changed files with 88 additions and 68 deletions

View File

@@ -31,8 +31,8 @@ class WikiDeleteLogEntry < WikiLogEntry
def undo!(current_user)
w = WikiPage.find_with_deleted(target_id)
w.update_attribute(:deleted_at, nil)
w.position = w.course.wiki_pages.maximum(:position) + 1
w.save!
w.position = w.course.wiki_pages.maximum(:position) + 1
w.save!
WikiRestoreLogEntry.create!(:target_id => w.id, :user_id => current_user.id,
:course => w.course)
end