尝试使用 FasterCSV 将 CSV 导入多个表
我有一个 fastCSV rake 脚本,但它只导入到 1 个表。我正在导入产品,并且该产品在其他表上存储了几条信息。
当前脚本: http://gist.github.com/321889
我需要添加的是某种方式同时将产品信息导入到另一个表中。说出类别名称。
行,
product.name = row[2]
product.available_on = Time.now
product.description = row[3]
product.vendor_sku = row[12]
product.price = row[13]#.to_d
product.save(false)
在这种情况下:我需要像taxon.name = row[14] 这样的
这可能吗?
I have a fasterCSV rake script but it only imports to 1 table. I am importing products and the products have several pieces of info stored on other tables.
Current script: http://gist.github.com/321889
What I need to add is some way to import product info to another table at the same time. Say a category name.
In this case: the rows
product.name = row[2]
product.available_on = Time.now
product.description = row[3]
product.vendor_sku = row[12]
product.price = row[13]#.to_d
product.save(false)
I need an item like taxon.name = row[14]
is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试类似的方法:
我这样做: http://gist.github.com/324613
危害
Try something like:
I do it that way: http://gist.github.com/324613
Harm