diff --git a/app/models/scheme.rb b/app/models/scheme.rb index e2036c7ed..99b3b1e02 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -10,6 +10,8 @@ class Scheme < ApplicationRecord scope :search_by_postcode, ->(postcode) { joins(:locations).where("locations.postcode ILIKE ?", "%#{postcode.delete(' ')}%") } scope :search_by, ->(param) { search_by_postcode(param).or(search_by_service_name(param)).or(search_by_code(param)).distinct } + validates :organisation_id, presence: { message: I18n.t("validations.scheme.organisation_id_missing") } + SENSITIVE = { No: 0, Yes: 1, diff --git a/config/locales/en.yml b/config/locales/en.yml index 71fb99454..8ce37bf66 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -44,9 +44,12 @@ en: scheme: attributes: organisation: - required: "Enter the organisation’s name" + required: "" validations: + scheme: + organisation_id_missing: "Enter the organisation’s name" + organisation: name_missing: "Enter the organisation’s name" provider_type_missing: "Select the organisation’s type"