TypeError: no implicit conversion of String into Integer

I am trying to parse an open data XML file from the internet into my rails database. Following is the code which should parse it:

require 'rake' 
require 'open-uri' 
namespace :db do 
  task :xml_parser => :environment do 
    doc = Nokogiri::XML(open("https://dl.dropboxusercontent.com/u/21695507/openplaques/gb_20151004.xml")) 
    doc.css('plaque').each do |node| 
      children = node.children 
        :title => children.css('title').inner_text,
        :subject => children.css('subjects').inner_text,
        :colour => children.css('colour').inner_text,
        :inscription => children.css('inscription raw').inner_text,
        :latitude => children.css('geo')["latitude"].text,
        :longitude => children.css('geo')["longitude"].text,
        :address => children.css('address').inner_text,
        :organisation => children.css('organisation').inner_text,
        :date_erected => children.css('date_erected').inner_text

And here is the schema:

create_table "plaques", force: :cascade do |t|
  t.string   "title"
  t.string   "subject"
  t.string   "colour"
  t.text     "inscription"
  t.string   "latitude"
  t.string   "longitude"
  t.text     "address"
  t.text     "organisation"
  t.string   "date_erected"
  t.datetime "created_at",   null: false
  t.datetime "updated_at",   null: false

I run rake db:xml_parser and I get the following error:

TypeError: no implicit conversion of String into Integer

Below is a sample from the XML file I am trying to parse.

<plaque uri="http://openplaques.org/plaques/4856" machine_tag="openplaques:id=4856" created_at="2010-11-26T13:58:23+00:00" updated_at="2011-06-28T17:00:01+01:00">
  <title>Arthur Linton blue plaque</title>
  <subjects>Arthur Linton</subjects>
      World Champion Cyclist 1895 lived here Arthur Linton 1872-1896
      World Champion Cyclist 1895 lived here <a href="/people/2934">Arthur Linton</a> 1872-1896
  <geo reference_system="WGS84" latitude="51.7005" longitude="-3.4251" is_accurate="true" />
    <address>Sheppard's Pharmacy, 218 Cardiff Road</address>
    <locality uri="">Aberaman</locality>
    <country uri="">United Kingdom</country>
  <organisation uri="">Rhondda Cynon Taf Council</organisation>
  <person uri="">Arthur Linton</person>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s