Skip to content

Instantly share code, notes, and snippets.

@rubyonrailstutor
Created April 18, 2013 23:49
Show Gist options
  • Save rubyonrailstutor/5417097 to your computer and use it in GitHub Desktop.
Save rubyonrailstutor/5417097 to your computer and use it in GitHub Desktop.
this sounds greek to me...
def process_datum
self.raw_data.each do |datum|
company = Company.where(name: datum[1]).first_or_create(url: datum[2], cb_url: datum[3])
a = datum[0].split("/").each_with_index {|e,i| e.insert(0,"20") if i == 1}.reverse.map {|e| e.to_i}
date = Date.new(a[0], a[1])
event = Event.where(funding_type: datum[4], date: date, value: datum[5]).first_or_create
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment