Created
June 17, 2009 19:42
-
-
Save brandon-beacher/131444 to your computer and use it in GitHub Desktop.
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
module Importers | |
module Kentucky | |
class KentuckyEmailRow < Importers::EmailRow | |
def self.load_rows | |
connection.create_table("kentucky_email_rows", :force => true) do |t| | |
t.string "family_number_and_individual_number" | |
t.string "description" | |
t.string "email_addr" | |
t.string "email_unlisted" | |
end | |
FasterCSV.foreach("app/lib/importers/kentucky/kentucky_emails.csv") do |row| | |
create \ | |
:family_number_and_individual_number => "#{row[0]}_#{row[1]}", | |
:description => row[2], | |
:email_addr => row[3], | |
:email_unlisted => row[4] | |
end | |
# connection.execute "delete from kentucky_email_rows where email_addr in (select email_addr from kentucky_email_rows group by email_addr having count(email_addr) > 1)" | |
end | |
def duplicates_exist? | |
KentuckyEmailRow.count(:conditions => { :email_addr => email_addr }) > 1 | |
end | |
def get_address | |
email_addr | |
end | |
def get_kind | |
description | |
end | |
def get_primary | |
description == "E-mail" ? true : false | |
end | |
def get_public | |
!email_unlisted.affirmative? | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment