diff options
-rw-r--r-- | app/models/project.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 507228606df..ef9b2e2d464 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -27,7 +27,6 @@ class Project < ActiveRecord::Base after_create :ensure_dir_exist after_save :ensure_dir_exist, if: :namespace_id_changed? - after_initialize :setup_project_feature # set last_activity_at to the same as created_at after_create :set_last_activity_at @@ -1306,17 +1305,17 @@ class Project < ActiveRecord::Base end end + # Build the association if not exists already when access to it + def project_feature + super || (build_project_feature and super) + end + private def pushes_since_gc_redis_key "projects/#{id}/pushes_since_gc" end - # Prevents the creation of project_feature record for every project - def setup_project_feature - build_project_feature unless project_feature - end - def default_branch_protected? current_application_settings.default_branch_protection == Gitlab::Access::PROTECTION_FULL || current_application_settings.default_branch_protection == Gitlab::Access::PROTECTION_DEV_CAN_MERGE |