Skip to content

Commit ee93956

Browse files
committed
rename validator classes
1 parent 0a93401 commit ee93956

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

app/models/activity.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Activity < ApplicationRecord
66
validates :action, presence: true, inclusion: { in: %w[create update destroy] }
77
validates :project, presence: true
88
validates :user, presence: true
9-
validates :subject, presence: true, subject_changed: true
9+
validates :subject, presence: true, changed: true
1010

1111
serialize :subject_changes, Hash
1212

app/models/story.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ def from_csv_row(row)
102102
enumerize :story_type, in: STORY_TYPES, predicates: true, scope: true
103103
validates :project, presence: true
104104
validates :title, presence: true
105-
validates :requested_by_id, user_belongs_to_project: true
106-
validates :owned_by_id, user_belongs_to_project: true
105+
validates :requested_by_id, belongs_to_project: true
106+
validates :owned_by_id, belongs_to_project: true
107107
validates :story_type, presence: true
108-
validates :estimate, central_estimate: true, allow_nil: true
108+
validates :estimate, estimate: true, allow_nil: true
109109
validate :validate_non_estimable_story
110110

111111
def self.csv_headers

app/validators/user_belongs_to_project_validator.rb app/validators/belongs_to_project_validator.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
class UserBelongsToProjectValidator < ActiveModel::EachValidator
2-
# TODO: Change de name class to BelongsToProjectValidator when remove support gem
1+
class BelongsToProjectValidator < ActiveModel::EachValidator
32
# Checks that the parameter being validated represents a User#id that
43
# is a member of the object.project
54
def validate_each(record, attribute, value)

app/validators/subject_changed_validator.rb app/validators/changed_validator.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# TODO: Change the class name to ChangedValidator when remove cm42-central-support gem
2-
class SubjectChangedValidator < ActiveModel::EachValidator
1+
class ChangedValidator < ActiveModel::EachValidator
32
def validate_each(record, attribute, value)
43
return if record.action != 'update'
54
return if value&.valid? && value&.saved_changes.present?

app/validators/central_estimate_validator.rb app/validators/estimate_validator.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
class CentralEstimateValidator < ActiveModel::EachValidator
2-
# TODO: Change the name to EstimateValidator when remove support gem
1+
class EstimateValidator < ActiveModel::EachValidator
32
# Checks that the estimate being validated is valid for record.project
43
def validate_each(record, attribute, value)
54
if record.project

0 commit comments

Comments
 (0)