From 75cf5f5b548c6e6df47eff721a31cd70fe202451 Mon Sep 17 00:00:00 2001 From: Mario de la Ossa Date: Fri, 29 Dec 2017 17:36:57 -0600 Subject: User#projects_limit remove DB default and added NOT NULL constraint This change is required because otherwise if a user is created with a value for `projects_limit` that matches the DB default, it gets overwritten by `current_application_settings.default_projects_limit`. By removing the default we once again can allow a user to be created with a limit of 10 projects without the risk that it'll change to 10000 --- app/models/user.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'app') diff --git a/app/models/user.rb b/app/models/user.rb index b52f17cd6a8..c4ca7fba794 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -794,10 +794,7 @@ class User < ActiveRecord::Base # `User.select(:id)` raises # `ActiveModel::MissingAttributeError: missing attribute: projects_limit` # without this safeguard! - return unless has_attribute?(:projects_limit) - - connection_default_value_defined = new_record? && !projects_limit_changed? - return unless projects_limit.nil? || connection_default_value_defined + return unless has_attribute?(:projects_limit) && projects_limit.nil? self.projects_limit = current_application_settings.default_projects_limit end -- cgit v1.2.1