Sha256: 1faa1da9d851422b288af819716b576063964acdaf777770d2013b7d531a3470
Contents?: true
Size: 406 Bytes
Versions: 62
Compression:
Stored size: 406 Bytes
Contents
class Country def self.search_for(value) all.detect do |country| country.alpha2.casecmp?(value.to_s) || country.alpha3.casecmp?(value.to_s) || country.name.casecmp?(value.to_s) || country.unofficial_names.any? { |name| name.casecmp?(value.to_s) } end end # Without this, any Country objects put in JSON render much verbose def as_json(*) alpha2 end end
Version data entries
62 entries across 62 versions & 1 rubygems