Your code depends on the order of the scraped table (or the order you are scraping the data off the table), which seems a little brittle. I would use an explicit mapping from table field names to model attribute names (or vice-versa, it doesn't really matter for a 1:1 mapping):
attrs = {
:field1 => :address1,
:field2 => :address2,
:field3 => :address3,
:field4 => :city
}
Given a hash:
hash = { field1: 'name', field2: 'street1', field3: 'street2', field4: 'city' }
it can be converted via:
attrs.map { |k, v| [v, hash[k]] }.to_h
#=> {:address1=>"name", :address2=>"street1", :address3=>"street2", :city=>"city"}