In release 4.2 the #name attribute was deprecated in favour of #iso_short_name and we added the #iso_long_name attribute, to make it clear that these attributes use the ISO3166 names, and are not the "common names" most people might expect, eg: The ISO name for "United Kingdom" is "United Kingdom of Great Britain and Northern Ireland", but if you're building a dropdown box to select a country, you're likely expecting to see "United Kingdom" instead.
"Common names" in English have been available in the translation data, via #translation('en'). As of release 4.2, a shortcut method has been added for simplicity, #common_name, which delegates to #translation('en').
For additional clarity, the #names method, which was an alias to #unofficial_names has also been deprecated, together with the finder methods that use name or names attributes.
The #name and #names attributes, and corresponding finder methods were removed in 5.0.
The replacement finders added in 5.0 are:
#find_by_name => #find_by_any_name - Searches all the name attributes, same as before
#find_by_names => #find_by_unofficial_names
#find_*_by_name => #find_*_by_any_name
#find_*_by_names => #find_*_by_unofficial_names
With the addition of the new name attributes, there are now also the following finders:
#find_by_common_name/#find_*_by_common_name
#find_by_iso_short_name/#find_*_by_iso_short_name
#find_by_iso_long_name/#find_*_by_iso_long_name
For translated country names, we use data originally sourced from pkg-isocodes, via the i18n_data gem, and these generally correspond to the expected "common names". Some corrections have been applied to these localized names. The methods to access translated names have not been changed.
The 5.0 release removed support for Ruby 2.5 (EOL 2021-03-01) and 2.6 (EOL 2022-03-31)
Upgrading to 5.1
In release 5.1 a type attribute was added to the subdivisions object, to allow filtering the collection of subdivisions.
Country#subdivision_types returns a list of subdivision types for that country (lowercase, snake_cased)
#subdivisions_of_types(types) accepts an array of subdivision types and returns the subdivisions for those types
The #states method is deprecated to avoid confusion, as this method is an alias to #subdivisions and returns all subdivisions, regardless of type.
To get a list of state subdivisions (something that was not possible before 5.1), use subdivisions_of_types(['state'])
Please note that the subdivision types are obtained from ISO data, and each country defines its own subdivision types, eg: state, district, region, municipality and many others types exist.
Upgrading to 7.0
In release 7.0, the long-deprecated #states method has been removed. More information above (Upgrading to 5.1)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps countries from 3.1.0 to 7.0.0.
Release notes
Sourced from countries's releases.
... (truncated)
Changelog
Sourced from countries's changelog.
... (truncated)
Upgrade guide
Sourced from countries's upgrade guide.
Commits
3639158
Update cache and CHANGELOG, bump versionb0b68f0
Merge pull request #868 from countries/remove_ruby_3002ecab3
Remove support for Ruby 3.0 and update dependenciesc85fc89
Merge pull request #869 from countries/remove_deprecated_method1e34ab7
Remove deprecated#state
method; Fix rubocop issues1b671bb
Merge pull request #866 from CoderMiguel/fix_for_country_finder_method_missing1781e40
Merge pull request #865 from lacco/lazy-load-default-localesc217803
fix and tests8113141
revert spec change2a6f7d9
revert reset changeDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show