Removes hardcoded table names (#2701).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2424 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-02-09 17:24:06 +00:00
parent 27e3b31c1e
commit c687219113
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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