summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-14 12:58:33 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-14 12:58:33 +0100
commit3025824415184c16f86bb67276474113de48d813 (patch)
tree2c22c8d50f079e40124942781d29ca9211a3e79e
parent7e45ba700415a180998cee5eb36158727be5f051 (diff)
downloadgitlab-ce-3025824415184c16f86bb67276474113de48d813.tar.gz
API: refactored last fix, project limit in web client is fixed too
The previous call `saved?` is restored in the `POST /projects` method in the API. It is refactored to check if the record is persisted. This is useful to not validate the record again after saving. This fixes the returned status code in the web client too. If the last project is created via web client instead of error notification the project page is shown.
-rw-r--r--app/models/project.rb2
-rw-r--r--lib/api/projects.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 15b2d858b62..ea8e0ecfd40 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -146,7 +146,7 @@ class Project < ActiveRecord::Base
end
def saved?
- id && valid?
+ id && persisted?
end
def import?
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index e0c1e338290..d416121a78a 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -44,7 +44,7 @@ module Gitlab
:merge_requests_enabled,
:wiki_enabled]
@project = ::Projects::CreateContext.new(current_user, attrs).execute
- if @project.persisted?
+ if @project.saved?
present @project, with: Entities::Project
else
not_found!