Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
8d8282b4
Commit
8d8282b4
authored
Oct 11, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a safeguard in User#set_projects_limit
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
ebba4914
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
app/models/user.rb
app/models/user.rb
+5
-0
No files found.
app/models/user.rb
View file @
8d8282b4
...
@@ -589,6 +589,11 @@ class User < ActiveRecord::Base
...
@@ -589,6 +589,11 @@ class User < ActiveRecord::Base
end
end
def
set_projects_limit
def
set_projects_limit
# `User.select(:id)` raises
# `ActiveModel::MissingAttributeError: missing attribute: projects_limit`
# without this safeguard!
return
unless
self
.
has_attribute?
(
:projects_limit
)
connection_default_value_defined
=
new_record?
&&
!
projects_limit_changed?
connection_default_value_defined
=
new_record?
&&
!
projects_limit_changed?
return
unless
self
.
projects_limit
.
nil?
||
connection_default_value_defined
return
unless
self
.
projects_limit
.
nil?
||
connection_default_value_defined
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment