-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validating A levels when the course is teacher degree apprenticeship
We need to add a validation for the A levels when publishing a course. I added the option render_errors: with default being true to avoid breaking existing code but passing false to A levels Because: * The A levels are a multi step form and I need to inject the error on the row in any way is described in the card * The row has the wizard step name attached to the link so different from the way GCSEs or degrees or others are doing when publishing
- Loading branch information
1 parent
edf18bc
commit dd9d3d1
Showing
13 changed files
with
563 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
class ALevelCourseValidator < ActiveModel::Validator | ||
def validate(record) | ||
return record.errors.add(:a_level_requirements, :blank) if record.a_level_requirements.nil? | ||
|
||
return if record.a_level_requirements.blank? # No A level required | ||
|
||
return record.errors.add(:a_level_subject_requirements, :blank) if record.a_level_subject_requirements.blank? | ||
|
||
return record.errors.add(:accept_pending_a_level, :blank) if record.accept_pending_a_level.nil? | ||
|
||
record.errors.add(:accept_a_level_equivalency, :blank) if record.accept_a_level_equivalency.nil? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.