diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-04 17:36:15 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-04 17:36:15 +0000 |
commit | fb3b904b8ffbe65ba11ed68252cdb441421b9a2b (patch) | |
tree | 59a297f8cd97d158dd57d552bc00df1387173ace /app/models/issue.rb | |
parent | b9c26d6ddcd3b2afa91637d0f81738e7d2e6c17a (diff) | |
download | redmine-fb3b904b8ffbe65ba11ed68252cdb441421b9a2b.tar.gz redmine-fb3b904b8ffbe65ba11ed68252cdb441421b9a2b.zip |
Better handling of issue update conflicts (#8691).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8774 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index f6c458990..098113bdf 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -436,6 +436,15 @@ class Issue < ActiveRecord::Base @current_journal end + # Returns the id of the last journal or nil + def last_journal_id + if new_record? + nil + else + journals.first(:order => "#{Journal.table_name}.id DESC").try(:id) + end + end + # Return true if the issue is closed, otherwise false def closed? self.status.is_closed? @@ -692,8 +701,7 @@ class Issue < ActiveRecord::Base end rescue ActiveRecord::StaleObjectError attachments[:files].each(&:destroy) - errors.add :base, l(:notice_locking_conflict) - raise ActiveRecord::Rollback + raise ActiveRecord::StaleObjectError end end end |