Ordem correta

This commit is contained in:
2009-09-06 20:34:35 -03:00
parent c2ac38da0c
commit c168bb62df
4 changed files with 8 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ class WikiDeleteLogEntry < WikiLogEntry
end
def undo!(current_user)
wiki_page.update_attribute(:deleted_at, nil)
wiki_page.update_attribute(:position, wiki_page.course.wiki_pages.maximum(:position) + 1)
wiki_page.update_attribute(:position, (wiki_page.course.wiki_pages.maximum(:position)||0) + 1)
WikiRestoreLogEntry.create!(:target_id => wiki_page.id, :user_id => current_user.id, :course => wiki_page.course)
end
end