我已经用书面方法将数据从CSV中输入到DB。 这对我来说,是一小小 ,远离南斯拉夫:
def self.from_csv(data)
c = Company.new
FasterCSV.parse(data) do |row|
c.name = row[0]
c.street = row[1]
c.street_number = row[2]
c.apartament_number = row[3]
c.city = row[4]
c.post_code = row[5]
c.post_office_city = row[6]
c.nip = row[7]
c.regon = row[8]
c.vatin = row[9]
end
end
如何使其更加性化,或者在装上数据方面已经有什么平衡?