monterail / zip-codes

Identify city and state for given zip code
MIT License
109 stars 57 forks source link

Its not working for country France only working for US. #5

Closed dinshawraje closed 9 years ago

dinshawraje commented 9 years ago

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.

chytreg commented 9 years ago

Sorry but currently we support only US https://github.com/monterail/zip-codes/tree/master/lib/data

teamon commented 9 years ago

There are no plans to implement support any other country than US for now.