This commit is contained in:
albert
2013-03-08 16:46:47 -05:00
parent 86b87e0173
commit 2b5a44a4fa
5 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
class UploadedTagsImporter
attr_reader :user
def initialize(user)
@user = user
end
def import!
row = connection.exec("SELECT uploaded_tags FROM users WHERE id = #{user.id}").first
if row
user.update_attribute(:favorite_tags, row["uploaded_tags"])
end
connection.close
rescue Exception
end
def connection
@connection ||= PGconn.connect(:dbname => "danbooru", :host => "dbserver", :user => "albert")
end
end