summaryrefslogtreecommitdiffstats
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index ad2f1fb81..a223b35f0 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -124,6 +124,12 @@ class Project < ActiveRecord::Base
statements.empty? ? base_statement : "((#{base_statement}) AND (#{statements.join(' OR ')}))"
end
+ def project_condition(with_subprojects)
+ cond = "#{Project.table_name}.id = #{id}"
+ cond = "(#{cond} OR #{Project.table_name}.parent_id = #{id})" if with_subprojects
+ cond
+ end
+
def self.find(*args)
if args.first && args.first.is_a?(String) && !args.first.match(/^\d*$/)
project = find_by_identifier(*args)