Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Integration between Rails and countries gem.
Add this line to your application's Gemfile:
gem 'rails-countries'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rails-countries
class Person < ActiveRecord::Base
validates :my_attribute, countries_alpha2: true
# or
validates_countries_alpha2_of :my_attribute
validates :another_attribute, countries_alpha3: true
# or
validates_countries_alpha3_of :another_attribute
end
class Person
include ActiveModel::Model
validates :my_attribute, countries_alpha2: true
# or
validates_countries_alpha2_of :my_attribute
validates :another_attribute, countries_alpha3: true
# or
validates_countries_alpha3_of :another_attribute
end
<%= i18n_country_name_by_alpha2('US') %>
<%= i18n_country_name_by_alpha2('US', 'pt-BR') %>
<%= i18n_country_name_by_alpha3('USA') %>
<%= i18n_country_name_by_alpha3('USA', 'pt-BR') %>
<%= select_tag(:my_attribute, countries_alpha2_options) %>
<%= select_tag(:my_attribute, countries_alpha2_options('pt-BR')) %>
<%= select_tag(:another_attribute, countries_alpha3_options) %>
<%= select_tag(:another_attribute, countries_alpha3_options('pt-BR')) %>
<%= f.input :my_attribute, collection: countries_alpha2_options %>
<%= f.input :my_attribute, collection: countries_alpha2_options('pt-BR') %>
<%= f.input :my_attribute, collection: countries_alpha3_options %>
<%= f.input :my_attribute, collection: countries_alpha3_options('pt-BR') %>
To customize your error messages you can create a locale file like this:
en:
errors:
messages:
countries_alpha2_invalid: '%{alpha2} is not valid'
countries_alpha3_invalid: '%{alpha3} is not valid'
Help us to improve the features and translations of this gem! Your contribution will be welcome :tada:
FAQs
Unknown package
We found that rails-countries demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.