From c68721911370e2aa293fd951b933b5c7f74fd611 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 9 Feb 2009 17:24:06 +0000 Subject: [PATCH] Removes hardcoded table names (#2701). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2424 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/role.rb | 4 ++-- app/models/tracker.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/role.rb b/app/models/role.rb index beb13c03b..b07e7a039 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -31,9 +31,9 @@ class Role < ActiveRecord::Base raise "Can not copy workflow from a #{role.class}" unless role.is_a?(Role) raise "Can not copy workflow from/to an unsaved role" if proxy_owner.new_record? || role.new_record? clear - connection.insert "INSERT INTO workflows (tracker_id, old_status_id, new_status_id, role_id)" + + connection.insert "INSERT INTO #{Workflow.table_name} (tracker_id, old_status_id, new_status_id, role_id)" + " SELECT tracker_id, old_status_id, new_status_id, #{proxy_owner.id}" + - " FROM workflows" + + " FROM #{Workflow.table_name}" + " WHERE role_id = #{role.id}" end end diff --git a/app/models/tracker.rb b/app/models/tracker.rb index ecee908eb..7c5bae250 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -23,9 +23,9 @@ class Tracker < ActiveRecord::Base raise "Can not copy workflow from a #{tracker.class}" unless tracker.is_a?(Tracker) raise "Can not copy workflow from/to an unsaved tracker" if proxy_owner.new_record? || tracker.new_record? clear - connection.insert "INSERT INTO workflows (tracker_id, old_status_id, new_status_id, role_id)" + + connection.insert "INSERT INTO #{Workflow.table_name} (tracker_id, old_status_id, new_status_id, role_id)" + " SELECT #{proxy_owner.id}, old_status_id, new_status_id, role_id" + - " FROM workflows" + + " FROM #{Workflow.table_name}" + " WHERE tracker_id = #{tracker.id}" end end