summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-10 12:49:20 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-10 12:49:20 +0000
commit073b403bd933538a67761200376ef995f14f48dc (patch)
tree828a462393256f727f8f60405c624f985a0980a8
parent1c71eccff23063405ef3335836908b7de513fabc (diff)
downloadredmine-073b403bd933538a67761200376ef995f14f48dc.tar.gz
redmine-073b403bd933538a67761200376ef995f14f48dc.zip
Rails4: replace deprecated Relation#update_all at Project#create_time_entry_activity_if_needed
git-svn-id: http://svn.redmine.org/redmine/trunk@12614 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/project.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index a76587a5b..798e64f69 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -249,18 +249,17 @@ class Project < ActiveRecord::Base
# does not successfully save.
def create_time_entry_activity_if_needed(activity)
if activity['parent_id']
-
parent_activity = TimeEntryActivity.find(activity['parent_id'])
activity['name'] = parent_activity.name
activity['position'] = parent_activity.position
-
if Enumeration.overridding_change?(activity, parent_activity)
project_activity = self.time_entry_activities.create(activity)
-
if project_activity.new_record?
raise ActiveRecord::Rollback, "Overridding TimeEntryActivity was not successfully saved"
else
- self.time_entries.update_all("activity_id = #{project_activity.id}", ["activity_id = ?", parent_activity.id])
+ self.time_entries.
+ where(["activity_id = ?", parent_activity.id]).
+ update_all("activity_id = #{project_activity.id}")
end
end
end