Created
February 4, 2009 05:02
-
-
Save TheNicholasNick/57944 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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