Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Qpixel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Answers
Qpixel
Commits
df7d50d5
Commit
df7d50d5
authored
Jun 30, 2020
by
ArtOfCode-
Browse files
Options
Downloads
Patches
Plain Diff
Thaaaanks rubocop
parent
09ed7c02
Loading
Loading
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/tags_controller.rb
+3
-3
3 additions, 3 deletions
app/controllers/tags_controller.rb
app/models/tag.rb
+3
-1
3 additions, 1 deletion
app/models/tag.rb
with
6 additions
and
4 deletions
app/controllers/tags_controller.rb
+
3
−
3
View file @
df7d50d5
This diff is collapsed.
Click to expand it.
app/models/tag.rb
+
3
−
1
View file @
df7d50d5
...
...
@@ -7,7 +7,7 @@ class Tag < ApplicationRecord
belongs_to
:parent
,
class_name:
'Tag'
,
optional:
true
validates
:excerpt
,
length:
{
maximum:
600
},
allow_blank:
true
validates
:wiki_markdown
,
length:
{
maximum:
30000
},
allow_blank:
true
validates
:wiki_markdown
,
length:
{
maximum:
30
_
000
},
allow_blank:
true
validate
:parent_not_self
validate
:parent_not_own_child
...
...
@@ -26,6 +26,7 @@ class Tag < ApplicationRecord
def
parent_not_self
return
unless
parent_id
.
present?
if
parent_id
==
id
errors
.
add
(
:base
,
'A tag cannot be its own parent.'
)
end
...
...
@@ -33,6 +34,7 @@ class Tag < ApplicationRecord
def
parent_not_own_child
return
unless
parent_id
.
present?
if
all_children
.
include?
parent_id
errors
.
add
(
:base
,
"The
#{
parent
.
name
}
tag is already a child of this tag."
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment