scope:search_by_postcode,->(postcode){where("schemes.id IN (SELECT DISTINCT scheme_id FROM locations WHERE REPLACE(locations.postcode, ' ', '') ILIKE ?)","%#{postcode.delete(' ')}%")}
scope:search_by_location_name,->(name){where("schemes.id IN (SELECT DISTINCT scheme_id FROM locations WHERE locations.name ILIKE ?)","%#{name}%")}