From 7e6c2fdfb33be0a588226def648a74d69e21ee65 Mon Sep 17 00:00:00 2001 From: David May-Miller Date: Wed, 25 Oct 2023 09:37:40 +0100 Subject: [PATCH] CLDC-2895 Add squish to the names of locations, schemes, users, and institutions --- app/models/location.rb | 2 +- app/models/organisation.rb | 2 +- app/models/scheme.rb | 2 +- app/models/user.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/location.rb b/app/models/location.rb index 954c034f9..1a4d29451 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -16,7 +16,7 @@ class Location < ApplicationRecord before_validation :lookup_postcode!, if: :postcode_changed? - auto_strip_attributes :name + auto_strip_attributes :name, squish: true scope :search_by_postcode, ->(postcode) { where("REPLACE(postcode, ' ', '') ILIKE ?", "%#{postcode.delete(' ')}%") } scope :search_by_name, ->(name) { where("name ILIKE ?", "%#{name}%") } diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 77b5af50c..c7447cfe6 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -36,7 +36,7 @@ class Organisation < ApplicationRecord has_paper_trail - auto_strip_attributes :name + auto_strip_attributes :name, squish: true PROVIDER_TYPE = { LA: 1, diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 702c8a79d..08b3db265 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -75,7 +75,7 @@ class Scheme < ApplicationRecord validate :validate_confirmed validate :validate_owning_organisation - auto_strip_attributes :service_name + auto_strip_attributes :service_name, squish: true SENSITIVE = { No: 0, diff --git a/app/models/user.rb b/app/models/user.rb index c6deed8a1..8511762ef 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -38,7 +38,7 @@ class User < ApplicationRecord has_one_time_password(encrypted: true) - auto_strip_attributes :name + auto_strip_attributes :name, squish: true ROLES = { data_provider: 1,