Skip to content
Snippets Groups Projects
Commit a36195bd authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Validate project limit only when create project

parent 34c97a31
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -46,11 +46,14 @@ module Projects
@project.creator = current_user
 
if @project.save
@project.discover_default_branch
unless @project.group
@project.users_projects.create(project_access: UsersProject::MASTER, user: current_user)
@project.users_projects.create(
project_access: UsersProject::MASTER,
user: current_user
)
end
@project.discover_default_branch
end
 
@project
Loading
Loading
Loading
Loading
@@ -89,7 +89,7 @@ class Project < ActiveRecord::Base
format: { with: URI::regexp(%w(git http https)), message: "should be a valid url" },
if: :import?
 
validate :check_limit
validate :check_limit, on: :create
 
# Scopes
scope :without_user, ->(user) { where("projects.id NOT IN (:ids)", ids: user.authorized_projects.map(&:id) ) }
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment