From 331d98c2d26f683e790689bb738fe8f2345bedab Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Tue, 10 Aug 2010 17:09:28 +0200 Subject: [PATCH] fix first version for wiki --- app/controllers/wiki_controller.rb | 1 + app/models/wiki_content.rb | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 5c3f38e7..de72996c 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -84,6 +84,7 @@ class WikiController < ApplicationController end #@content.text = params[:content][:text] #@content.comments = params[:content][:comments] + @content.init_journal(User.current, params[:content][:comments]) @content.attributes = params[:content] @content.author = User.current # if page is new @page.save will also save content, but not if page isn't a new record diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb index 945fcaec..debe8093 100644 --- a/app/models/wiki_content.rb +++ b/app/models/wiki_content.rb @@ -57,15 +57,11 @@ class WikiContent < ActiveRecord::Base WikiContentJournal.class_eval do attr_protected :data after_save :compress_version_text - after_save :move_comments_to_notes # Wiki Content might be large and the data should possibly be compressed def compress_version_text self.text = changes["text"].last if changes["text"] - end - - def move_comments_to_notes - self.notes = changes.delete("comments").last if changes["comments"] + self.text ||= self.versioned.text end def text=(plain)