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

Added allow_blank to model validations

parent acbac26a
No related branches found
No related tags found
1 merge request!1Fix Links To Gitlab Cloud
require 'gon'
class ApplicationController < ActionController::Base
before_filter :authenticate_user!
before_filter :reject_blocked!
Loading
Loading
Loading
Loading
@@ -77,7 +77,7 @@ class Project < ActiveRecord::Base
 
# Validations
validates :creator, presence: true
validates :description, length: { within: 0..2000 }
validates :description, length: { maximum: 2000 }, allow_blank: true
validates :name, presence: true, length: { within: 0..255 },
format: { with: Gitlab::Regex.project_name_regex,
message: "only letters, digits, spaces & '_' '-' '.' allowed. Letter or digit should be first" }
Loading
Loading
@@ -87,7 +87,7 @@ class Project < ActiveRecord::Base
message: "only letters, digits & '_' '-' '.' allowed. Letter or digit should be first" }
validates :issues_enabled, :wall_enabled, :merge_requests_enabled,
:wiki_enabled, inclusion: { in: [true, false] }
validates :issues_tracker_id, length: { within: 0..255 }
validates :issues_tracker_id, length: { maximum: 255 }, allow_blank: true
 
validates :namespace, presence: true
validates_uniqueness_of :name, scope: :namespace_id
Loading
Loading
Loading
Loading
@@ -104,7 +104,7 @@ class User < ActiveRecord::Base
#
validates :name, presence: true
validates :email, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ }
validates :bio, length: { within: 0..255 }
validates :bio, length: { maximum: 255 }, allow_blank: true
validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider}
validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0}
validates :username, presence: true, uniqueness: true,
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