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
974d0214
Commit
974d0214
authored
Oct 09, 2019
by
allison.browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename project association validator
parent
6b915762
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/models/zoom_meeting.rb
app/models/zoom_meeting.rb
+1
-1
app/validators/same_project_association_validator.rb
app/validators/same_project_association_validator.rb
+3
-3
No files found.
app/models/zoom_meeting.rb
View file @
974d0214
...
...
@@ -5,7 +5,7 @@ class ZoomMeeting < ApplicationRecord
belongs_to
:issue
,
optional:
false
validates
:url
,
presence:
true
,
length:
{
maximum:
255
},
zoom_url:
true
validates
:issue
,
project_association:
true
validates
:issue
,
same_
project_association:
true
enum
issue_status:
{
added:
1
,
...
...
app/validators/project_association_validator.rb
→
app/validators/
same_
project_association_validator.rb
View file @
974d0214
# frozen_string_literal: true
#
Issu
eProjectAssociationValidator
#
Sam
eProjectAssociationValidator
#
# Custom validator to validate that the same project associated with
# the record is also associated with the value
...
...
@@ -10,9 +10,9 @@
# belongs_to :project, optional: false
# belongs_to :issue, optional: false
# validates :issue,
issu
e_project_association: true
# validates :issue,
sam
e_project_association: true
# end
class
ProjectAssociationValidator
<
ActiveModel
::
EachValidator
class
Same
ProjectAssociationValidator
<
ActiveModel
::
EachValidator
def
validate_each
(
record
,
attribute
,
value
)
return
if
record
.
project
==
value
&
.
project
...
...
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