diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-08 19:10:46 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-15 19:54:23 +0300 |
commit | 8a9164bf04fe20bfee9ea7923c655f4600e88c7f (patch) | |
tree | 61020f184356de6f2f62fbd32d939299ee46220f /app/models/project.rb | |
parent | af493ccf3658c9f8b1266a880eb1798fe30cb324 (diff) |
Set inverse_of for Project/Services relation
This ensures that code such as this don't run needless SQL queries:
project.gitlab_issue_tracker_service.project
This also means that if the root `project` eager loads any associations
the Service object will be able to re-use those.
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index fdbc84474ed..0bb815e64e7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -81,7 +81,7 @@ class Project < ActiveRecord::Base has_one :jira_service, dependent: :destroy has_one :redmine_service, dependent: :destroy has_one :custom_issue_tracker_service, dependent: :destroy - has_one :gitlab_issue_tracker_service, dependent: :destroy + has_one :gitlab_issue_tracker_service, dependent: :destroy, inverse_of: :project has_one :external_wiki_service, dependent: :destroy has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id" |