diff options
author | Mario de la Ossa <mariodelaossa@gmail.com> | 2017-12-30 02:36:57 +0300 |
---|---|---|
committer | Mario de la Ossa <mariodelaossa@gmail.com> | 2017-12-30 23:33:49 +0300 |
commit | 75cf5f5b548c6e6df47eff721a31cd70fe202451 (patch) | |
tree | f3e5dcb51c4db54ff29a40ec87df51e83a66c4d7 /app/models/user.rb | |
parent | 1b447b1642b4a1b91e595d319d7d90f2b43515ef (diff) |
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
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 5 |
1 files changed, 1 insertions, 4 deletions
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 |