Code cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10842 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2012-11-18 16:01:07 +00:00
1 parent 46d27348fd
commit f36b3fff60
2 files changed
+17 -11

No files matched your search

+15
View File
@@ -173,6 +173,21 @@ class WikiPage < ActiveRecord::Base
self.parent = parent_page
end
# Saves the page and its content if text was changed
def save_with_content
ret = nil
transaction do
if new_record?
# Rails automatically saves associated content
ret = save
else
ret = save && (content.text_changed? ? content.save : true)
end
raise ActiveRecord::Rollback unless ret
end
ret
end
protected
def validate_parent_title