fix first version for wiki
This commit is contained in:
parent
08a013da44
commit
331d98c2d2
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue