Browse Source

validation error messages for scheme

juris_katrina_test
JG 2 years ago
parent
commit
87745561a1
  1. 4
      app/models/scheme.rb
  2. 7
      config/locales/en.yml

4
app/models/scheme.rb

@ -4,6 +4,10 @@ class Scheme < ApplicationRecord
has_many :locations has_many :locations
has_many :case_logs has_many :case_logs
validates_presence_of :service_name
validates_presence_of :scheme_type
validates_presence_of :registered_under_care_act
scope :filter_by_id, ->(id) { where(id: (id.start_with?("S") ? id[1..] : id)) } scope :filter_by_id, ->(id) { where(id: (id.start_with?("S") ? id[1..] : id)) }
scope :search_by_service_name, ->(name) { where("service_name ILIKE ?", "%#{name}%") } scope :search_by_service_name, ->(name) { where("service_name ILIKE ?", "%#{name}%") }
scope :search_by_postcode, ->(postcode) { joins(:locations).where("locations.postcode ILIKE ?", "%#{postcode.delete(' ')}%") } scope :search_by_postcode, ->(postcode) { joins(:locations).where("locations.postcode ILIKE ?", "%#{postcode.delete(' ')}%") }

7
config/locales/en.yml

@ -46,6 +46,13 @@ en:
owning_organisation_id: owning_organisation_id:
required: "Enter the existing organisation’s name" required: "Enter the existing organisation’s name"
invalid: "Enter the existing organisation’s name" invalid: "Enter the existing organisation’s name"
blank: "Enter the existing organisation’s name"
service_name:
blank: "Enter the scheme’s name"
scheme_type:
blank: "Select the scheme’s type"
registered_under_care_act:
blank: "You must tell us if this scheme is registered under the Care Standards Act 2000"
validations: validations:
organisation: organisation:

Loading…
Cancel
Save