
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
countries_regions_and_cities_by_pete
Advanced tools
An agile way to implement Countries, Regions, and Cities in a Ruby On Rails scaffold without the need to create additional tables
Ruby On Rails: 5, 6, 7
Add this line to your application's Gemfile:
gem 'countries_regions_and_cities_by_pete'
And then execute:
$ bundle install
Let's create a example for a Place scaffold:
rails new myapp
bundle exec rake db:create
bundle exec rails g scaffold Place name:string description:text
gem 'countries_regions_and_cities_by_pete'
bundle install
bundle exec rake 'install_countries_regions_and_cities_by_pete[Place]'
<script src='/countries_regions_and_cities_by_pete/jquery-3.6.0.min.js'></script>
<div class="field" id="country_field">
<%= render partial: "shared/country_select_by_pete", locals: {model: form.object.class.name, label: "Country", selected: form.object.country} %>
</div>
<div class="field" id="region_field">
<%= render partial: "shared/region_select_by_pete", locals: {model: form.object.class.name, label: "Region / State", selected_country: form.object.country, selected: form.object.region} %>
</div>
<div class="field" id="city_field">
<%= render partial: "shared/city_select_by_pete", locals: {model: form.object.class.name, label: "City", selected_region: form.object.region, selected_country: form.object.country, selected: form.object.city} %>
</div>
def place_params
params.require(:place).permit(:name, :description, :address, :country, :region, :city)
end
Watch this video to see how it works
Bug reports and pull requests are welcome on GitHub at https://github.com/peterconsuegra/countries_regions_and_cities. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Everyone interacting in the CountriesRegionsAndCitiesByPeterconsuegra project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that countries_regions_and_cities_by_pete 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.