Commit c6872191 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Removes hardcoded table names (#2701).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2424 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 27e3b31c
...@@ -31,9 +31,9 @@ class Role < ActiveRecord::Base ...@@ -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 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? raise "Can not copy workflow from/to an unsaved role" if proxy_owner.new_record? || role.new_record?
clear 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}" + " SELECT tracker_id, old_status_id, new_status_id, #{proxy_owner.id}" +
" FROM workflows" + " FROM #{Workflow.table_name}" +
" WHERE role_id = #{role.id}" " WHERE role_id = #{role.id}"
end end
end end
......
...@@ -23,9 +23,9 @@ class Tracker < ActiveRecord::Base ...@@ -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 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? raise "Can not copy workflow from/to an unsaved tracker" if proxy_owner.new_record? || tracker.new_record?
clear 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" + " SELECT #{proxy_owner.id}, old_status_id, new_status_id, role_id" +
" FROM workflows" + " FROM #{Workflow.table_name}" +
" WHERE tracker_id = #{tracker.id}" " WHERE tracker_id = #{tracker.id}"
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment