Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dankmitchell/c0c85adbc07649ab0bdf5660bd39baf7 to your computer and use it in GitHub Desktop.
Save dankmitchell/c0c85adbc07649ab0bdf5660bd39baf7 to your computer and use it in GitHub Desktop.
Get sorted list of territory and country names excluding those with end_dates using Open Register Ruby client
# Add gem
gem 'openregister-ruby-client', git: 'https://github.com/openregister/openregister-ruby-client'
# Inside application.rb
require 'openregister-ruby'
c = OpenRegister.register('country', :beta)._all_records +
OpenRegister.register('territory', :beta)._all_records
c.select{|x| x.end_date.blank?}.map(&:name).sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment