diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-05-01 17:10:15 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-05-01 17:10:15 +0000 |
commit | c5ac2d3966c2ac04a2580fca67a40acf24b51239 (patch) | |
tree | 45f8eca2133899ea2bd8fd4841e14adb4709fc85 /app/models/time_entry_activity.rb | |
parent | 6c39a260a3c44c1d121a7421b1d6c09358da20a1 (diff) | |
download | redmine-c5ac2d3966c2ac04a2580fca67a40acf24b51239.tar.gz redmine-c5ac2d3966c2ac04a2580fca67a40acf24b51239.zip |
Fixed that deleting a system activity with children in use raises an error (#13783).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11763 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry_activity.rb')
-rw-r--r-- | app/models/time_entry_activity.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/time_entry_activity.rb b/app/models/time_entry_activity.rb index f2a18d1d0..58a6de13d 100644 --- a/app/models/time_entry_activity.rb +++ b/app/models/time_entry_activity.rb @@ -24,11 +24,15 @@ class TimeEntryActivity < Enumeration OptionName end + def objects + TimeEntry.where(:activity_id => self_and_descendants(1).map(&:id)) + end + def objects_count - time_entries.count + objects.count end def transfer_relations(to) - time_entries.update_all("activity_id = #{to.id}") + objects.update_all(:activity_id => to.id) end end |