summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-31 18:15:32 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-31 18:15:32 +0000
commit1b911e51f9625082a5e61ca62a78db284383c1d2 (patch)
treedc5d993becd523cb4c1610fc5f865934e771623f /app/models
parent10ebed3b97b8990a721e666dccbb607d78dc38be (diff)
downloadredmine-1b911e51f9625082a5e61ca62a78db284383c1d2.tar.gz
redmine-1b911e51f9625082a5e61ca62a78db284383c1d2.zip
Time entry queries should be copied and deleted too.
git-svn-id: http://svn.redmine.org/redmine/trunk@16320 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 967c82cb5..f071010e2 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -40,7 +40,7 @@ class Project < ActiveRecord::Base
has_many :versions, :dependent => :destroy
belongs_to :default_version, :class_name => 'Version'
has_many :time_entries, :dependent => :destroy
- has_many :queries, :class_name => 'IssueQuery', :dependent => :delete_all
+ has_many :queries, :dependent => :delete_all
has_many :documents, :dependent => :destroy
has_many :news, lambda {includes(:author)}, :dependent => :destroy
has_many :issue_categories, lambda {order("#{IssueCategory.table_name}.name")}, :dependent => :delete_all
@@ -1055,12 +1055,12 @@ class Project < ActiveRecord::Base
# Copies queries from +project+
def copy_queries(project)
project.queries.each do |query|
- new_query = IssueQuery.new
+ new_query = query.class.new
new_query.attributes = query.attributes.dup.except("id", "project_id", "sort_criteria", "user_id", "type")
new_query.sort_criteria = query.sort_criteria if query.sort_criteria
new_query.project = self
new_query.user_id = query.user_id
- new_query.role_ids = query.role_ids if query.visibility == IssueQuery::VISIBILITY_ROLES
+ new_query.role_ids = query.role_ids if query.visibility == ::Query::VISIBILITY_ROLES
self.queries << new_query
end
end