Hello I am using gem 'zip-codes' to match the zip-code with given state and city its working fine for US country, state and city. But for FRANCE its not working it as in European countries we don't have states we have province so its not working for that. I have written given code in my model:
validate :zip_and_city_match, on: [:create, :update]
def zip_and_city_match
@zip = ZipCodes.identify(self.zip)
if @zip.present?
unless self.state_code == @zip[:state_code] && self.city == @zip[:city]
self.errors.add(:zip, 'Does not match the provided city and state')
end
else
self.errors.add(:zip, 'Invalid Zip')
end
end
If I give country = France, state_code= Île-de-France, city = Paris and zip = 75001 so it gives error _Does not match the provided city and state_. Please help me out how to solve this. Thanks in advance.
Hello I am using
gem 'zip-codes'
to match the zip-code with given state and city its working fine for US country, state and city. But for FRANCE its not working it as in European countries we don't have states we have province so its not working for that. I have written given code in my model:If I give country = France, state_code= Île-de-France, city = Paris and zip = 75001 so it gives error _Does not match the provided city and state_. Please help me out how to solve this. Thanks in advance.