Sha256: ab3a01563fc3bc5f280b2d436d7632c944c280caabe4ff889f8e0bfc6225cf0c

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

require 'active_record'

module Cccode
  class CountryCode < ActiveRecord::Base

    def self.insert_all(xml)
      xml.css('Table').each_with_index do |_, idx|
        CountryCode.create(
          country: xml.css('Table/Name')[idx].text.strip,
          country_code: xml.css('Table/CountryCode')[idx].text.strip,
          currency: xml.css('Table/Currency')[idx].text.strip,
          currency_code: xml.css('Table/CurrencyCode')[idx].text.strip,
        )
      end
      true
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cccode-0.1.0 lib/cccode/models/country_code.rb