diff options
Diffstat (limited to 'sonar-server/src/main/webapp/WEB-INF/app/models/project.rb')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/models/project.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb index 8489caea88b..9658c9dfcb3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb @@ -43,6 +43,13 @@ class Project < ActiveRecord::Base root||self end + def root_project + @root_project ||= + begin + parent_module(self) + end + end + def last_snapshot @last_snapshot ||= begin @@ -153,4 +160,9 @@ class Project < ActiveRecord::Base end chart_measures end + + def parent_module(current_module) + current_module.root ? parent_module(current_module.root) : current_module + end + end |