Skip to content

Instantly share code, notes, and snippets.

@dannymcc
Created March 29, 2012 10:50
Show Gist options
  • Select an option

  • Save dannymcc/2235805 to your computer and use it in GitHub Desktop.

Select an option

Save dannymcc/2235805 to your computer and use it in GitHub Desktop.
# Add each row to a new call record
page = agent.page.search("table tbody tr").each do |row|
next if (!row.at('td'))
time, source, destination, duration = row.search('td')[1..5].map{ |td| td.text.strip }
call = Call.find_by_time(Time.parse(time))
call = Call.create_by_time(Time.parse(time))
call.update_attributes({:time => time, :source => source, :destination => destination, :duration => duration})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment