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
7029cd77
Commit
7029cd77
authored
Apr 07, 2021
by
Alexander Tanayno
Committed by
Achilleas Pipinellis
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix empty arguments in the cheat sheet
parent
12c2e6a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md
...dministration/troubleshooting/gitlab_rails_cheat_sheet.md
+12
-12
No files found.
doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md
View file @
7029cd77
...
@@ -215,8 +215,8 @@ project = Project.find_by_full_path('group-changeme/project-changeme')
...
@@ -215,8 +215,8 @@ project = Project.find_by_full_path('group-changeme/project-changeme')
### Destroy a project
### Destroy a project
```
ruby
```
ruby
project
=
Project
.
find_by_full_path
(
''
)
project
=
Project
.
find_by_full_path
(
'
<project_path>
'
)
user
=
User
.
find_by_username
(
''
)
user
=
User
.
find_by_username
(
'
<username>
'
)
ProjectDestroyWorker
.
perform_async
(
project
.
id
,
user
.
id
,
{})
ProjectDestroyWorker
.
perform_async
(
project
.
id
,
user
.
id
,
{})
# or ProjectDestroyWorker.new.perform(project.id, user.id, {})
# or ProjectDestroyWorker.new.perform(project.id, user.id, {})
# or Projects::DestroyService.new(project, user).execute
# or Projects::DestroyService.new(project, user).execute
...
@@ -225,8 +225,8 @@ ProjectDestroyWorker.perform_async(project.id, user.id, {})
...
@@ -225,8 +225,8 @@ ProjectDestroyWorker.perform_async(project.id, user.id, {})
### Remove fork relationship manually
### Remove fork relationship manually
```
ruby
```
ruby
p
=
Project
.
find_by_full_path
(
''
)
p
=
Project
.
find_by_full_path
(
'
<project_path>
'
)
u
=
User
.
find_by_username
(
''
)
u
=
User
.
find_by_username
(
'
<username>
'
)
::
Projects
::
UnlinkForkService
.
new
(
p
,
u
).
execute
::
Projects
::
UnlinkForkService
.
new
(
p
,
u
).
execute
```
```
...
@@ -243,13 +243,13 @@ project.update!(repository_read_only: true)
...
@@ -243,13 +243,13 @@ project.update!(repository_read_only: true)
### Transfer project from one namespace to another
### Transfer project from one namespace to another
```
ruby
```
ruby
p
=
Project
.
find_by_full_path
(
''
)
p
=
Project
.
find_by_full_path
(
'
<project_path>
'
)
# To set the owner of the project
# To set the owner of the project
current_user
=
p
.
creator
current_user
=
p
.
creator
# Namespace where you want this to be moved.
# Namespace where you want this to be moved.
namespace
=
Namespace
.
find_by_full_path
(
""
)
namespace
=
Namespace
.
find_by_full_path
(
"
<new_namespace>
"
)
::
Projects
::
TransferService
.
new
(
p
,
current_user
).
execute
(
namespace
)
::
Projects
::
TransferService
.
new
(
p
,
current_user
).
execute
(
namespace
)
```
```
...
@@ -468,7 +468,7 @@ end
...
@@ -468,7 +468,7 @@ end
### Skip reconfirmation
### Skip reconfirmation
```
ruby
```
ruby
user
=
User
.
find_by_username
''
user
=
User
.
find_by_username
'
<username>
'
user
.
skip_reconfirmation!
user
.
skip_reconfirmation!
```
```
...
@@ -558,7 +558,7 @@ user.max_member_access_for_group group.id
...
@@ -558,7 +558,7 @@ user.max_member_access_for_group group.id
```
ruby
```
ruby
user
=
User
.
find_by_username
(
'<username>'
)
user
=
User
.
find_by_username
(
'<username>'
)
group
=
Group
.
find_by_name
(
"<group_name>"
)
group
=
Group
.
find_by_name
(
"<group_name>"
)
parent_group
=
Group
.
find_by
(
id:
"
"
)
# empty string amounts to root as parent
parent_group
=
Group
.
find_by
(
id:
"
<group_id>"
)
service
=
::
Groups
::
TransferService
.
new
(
group
,
user
)
service
=
::
Groups
::
TransferService
.
new
(
group
,
user
)
service
.
execute
(
parent_group
)
service
.
execute
(
parent_group
)
```
```
...
@@ -679,7 +679,7 @@ conflicting_permanent_redirects.destroy_all
...
@@ -679,7 +679,7 @@ conflicting_permanent_redirects.destroy_all
```
ruby
```
ruby
p
=
Project
.
find_by_full_path
(
'<full/path/to/project>'
)
p
=
Project
.
find_by_full_path
(
'<full/path/to/project>'
)
m
=
p
.
merge_requests
.
find_by
(
iid:
<
iid
>
)
m
=
p
.
merge_requests
.
find_by
(
iid:
<
iid
>
)
u
=
User
.
find_by_username
(
''
)
u
=
User
.
find_by_username
(
'
<username>
'
)
MergeRequests
::
PostMergeService
.
new
(
p
,
u
).
execute
(
m
)
MergeRequests
::
PostMergeService
.
new
(
p
,
u
).
execute
(
m
)
```
```
...
@@ -695,9 +695,9 @@ Issuable::DestroyService.new(m.project, u).execute(m)
...
@@ -695,9 +695,9 @@ Issuable::DestroyService.new(m.project, u).execute(m)
### Rebase manually
### Rebase manually
```
ruby
```
ruby
p
=
Project
.
find_by_full_path
(
''
)
p
=
Project
.
find_by_full_path
(
'
<project_path>
'
)
m
=
project
.
merge_requests
.
find_by
(
iid:
)
m
=
project
.
merge_requests
.
find_by
(
iid:
)
u
=
User
.
find_by_username
(
''
)
u
=
User
.
find_by_username
(
'
<username>
'
)
MergeRequests
::
RebaseService
.
new
(
m
.
target_project
,
u
).
execute
(
m
)
MergeRequests
::
RebaseService
.
new
(
m
.
target_project
,
u
).
execute
(
m
)
```
```
...
@@ -734,7 +734,7 @@ build.dependencies.each do |d| { puts "status: #{d.status}, finished at: #{d.fin
...
@@ -734,7 +734,7 @@ build.dependencies.each do |d| { puts "status: #{d.status}, finished at: #{d.fin
### Try CI service
### Try CI service
```
ruby
```
ruby
p
=
Project
.
find_by_full_path
(
''
)
p
=
Project
.
find_by_full_path
(
'
<project_path>
'
)
m
=
project
.
merge_requests
.
find_by
(
iid:
)
m
=
project
.
merge_requests
.
find_by
(
iid:
)
m
.
project
.
try
(
:ci_service
)
m
.
project
.
try
(
:ci_service
)
```
```
...
...
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