Created
April 18, 2013 23:49
-
-
Save rubyonrailstutor/5417097 to your computer and use it in GitHub Desktop.
this sounds greek to me...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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