mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-06 07:31:31 +00:00
Rescue RecordNotSaved in #save_with_content.
git-svn-id: http://svn.redmine.org/redmine/trunk@13696 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5222650d95
commit
9a7604981b
@ -185,11 +185,6 @@ class WikiController < ApplicationController
|
||||
}
|
||||
format.api { render_api_head :conflict }
|
||||
end
|
||||
rescue ActiveRecord::RecordNotSaved
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
format.api { render_validation_errors(@content) }
|
||||
end
|
||||
end
|
||||
|
||||
# rename a page
|
||||
|
||||
@ -216,13 +216,18 @@ class WikiPage < ActiveRecord::Base
|
||||
end
|
||||
|
||||
# Saves the page and its content if text was changed
|
||||
# Return true if the page was saved
|
||||
def save_with_content(content)
|
||||
ret = nil
|
||||
transaction do
|
||||
ret = save
|
||||
if content.text_changed?
|
||||
self.content = content
|
||||
ret = ret && content.changed?
|
||||
begin
|
||||
self.content = content
|
||||
ret = ret && content.changed?
|
||||
rescue ActiveRecord::RecordNotSaved
|
||||
ret = false
|
||||
end
|
||||
end
|
||||
raise ActiveRecord::Rollback unless ret
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user