diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-12-03 20:22:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-12-03 20:22:46 +0000 |
commit | 9a7604981b78fa0c1265b99302420c696be1f13f (patch) | |
tree | bac2ff037b42110c1ce9d9647d197d62c7eaabc4 /app/models/wiki_page.rb | |
parent | 5222650d952390d3435848397a46d8aa1dbda09e (diff) | |
download | redmine-9a7604981b78fa0c1265b99302420c696be1f13f.tar.gz redmine-9a7604981b78fa0c1265b99302420c696be1f13f.zip |
Rescue RecordNotSaved in #save_with_content.
git-svn-id: http://svn.redmine.org/redmine/trunk@13696 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r-- | app/models/wiki_page.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 9d68de2b6..61e78873d 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -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 |