Skip to content

Instantly share code, notes, and snippets.

@TheNicholasNick
Created February 4, 2009 05:02
Show Gist options
  • Save TheNicholasNick/57944 to your computer and use it in GitHub Desktop.
Save TheNicholasNick/57944 to your computer and use it in GitHub Desktop.
class Rfprsn
include DataMapper::Resource
...
def self.imported?
if File.exist?(FILE_IN)
options = {:headers => true,
:header_converters => :symbol}
lines = []
self.all.destroy! # make sure we are empty first!
FasterCSV.foreach(FILE_IN, options) do |row|
self.create(row.to_hash)
end
return true
end
false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment