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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e7e999cf
Commit
e7e999cf
authored
Mar 18, 2020
by
Wei-Meng Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prune Rails Console cheat sheet
parent
502cdc4a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
69 deletions
+0
-69
doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md
...dministration/troubleshooting/gitlab_rails_cheat_sheet.md
+0
-69
No files found.
doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md
View file @
e7e999cf
...
...
@@ -160,18 +160,6 @@ GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone <repository>
## Projects
### Find projects
```
ruby
# A single project
project
=
Project
.
find_by_full_path
(
'PROJECT_PATH'
)
# All projects in a particular namespace. Can be a username, a group
# ('gitlab-org'), or even include subgroups ('gitlab-org/distribution')
namespace
=
Namespace
.
find_by_full_path
(
'NAMESPACE_PATH'
)
projects
=
namespace
.
all_projects
```
### Clear a project's cache
```
ruby
...
...
@@ -407,35 +395,6 @@ end
## Users
### Finding users
```
ruby
# By username
user
=
User
.
find_by
(
username:
''
)
# By primary email
user
=
User
.
find_by
(
email:
''
)
# By any email (primary or secondary)
user
=
User
.
find_by_any_email
(
''
)
# Admins
User
.
admins
admin
=
User
.
admins
.
first
```
### Block
```
ruby
User
.
find_by_username
().
block!
```
### Unblock
```
ruby
User
.
find_by_username
().
active
```
### Skip reconfirmation
```
ruby
...
...
@@ -476,13 +435,6 @@ User.find(123).personal_access_tokens.create(
)
```
### Disable 2FA on a user
```
ruby
user
=
User
.
find_by_username
(
'username'
)
user
.
disable_two_factor!
```
### Active users & Historical users
```
ruby
...
...
@@ -546,20 +498,6 @@ group = Group.find_by_full_path 'group'
user
.
max_member_access_for_group
group
.
id
```
### Change user password
```
ruby
password
=
"your password"
user
=
User
.
find_by_username
(
'your username'
)
password_attributes
=
{
password:
password
,
password_confirmation:
password
,
password_automatically_set:
false
}
result
=
Users
::
UpdateService
.
new
(
user
,
password_attributes
.
merge
(
user:
user
)).
execute
```
## Groups
### Count unique users in a group and sub-groups
...
...
@@ -706,13 +644,6 @@ conflicting_permanent_redirects.destroy_all
## Merge Requests
### Find Merge Request
```
ruby
m
=
project
.
merge_requests
.
find_by
(
iid:
<
IID
>
)
m
=
MergeRequest
.
find_by_title
(
'NEEDS UNIQUE TITLE!!!'
)
```
### Close a merge request properly (if merged but still marked as open)
```
ruby
...
...
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