Commit 974d0214 authored by allison.browne's avatar allison.browne

Rename project association validator

parent 6b915762
......@@ -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,
......
# frozen_string_literal: true
# IssueProjectAssociationValidator
# SameProjectAssociationValidator
#
# 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, issue_project_association: true
# validates :issue, same_project_association: true
# end
class ProjectAssociationValidator < ActiveModel::EachValidator
class SameProjectAssociationValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return if record.project == value&.project
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment