OSDN Git Service

顧客情報、発送情報、商品情報のCSVアップロードをできるようにした
authorymatsumoto <ymatsumoto@appirits.com>
Fri, 3 May 2013 17:56:34 +0000 (02:56 +0900)
committerymatsumoto <ymatsumoto@appirits.com>
Fri, 3 May 2013 17:56:34 +0000 (02:56 +0900)
app/models/customer.rb
app/models/order_delivery.rb
app/models/product.rb

index 9336d68..19a4a93 100644 (file)
@@ -416,7 +416,7 @@ class Customer < ActiveRecord::Base
     def add_by_csv(file)
       line = 0
       Customer.transaction do
-        CSV::Reader.parse(file) do |row|
+        CSV.parse(file) do |row|
           if line != 0
             customer = new_by_array(row)
             unless customer.save!
index 72fff90..9e1b6e9 100644 (file)
@@ -257,7 +257,7 @@ class OrderDelivery < ActiveRecord::Base
       line = 0
       update_line = 0
       OrderDelivery.transaction do
-        CSV::Reader.parse(file) do |row|
+        CSV.parse(file) do |row|
           if line != 0
             record = OrderDelivery.find_by_order_id(row[0].to_i)
             return [line-1, update_line, false] if record.order.retailer_id != retailer_id
index f12d738..86b2b9f 100644 (file)
@@ -340,7 +340,7 @@ class Product < ActiveRecord::Base
     def add_by_csv(file, retailer_id)
       line = 0
       Product.transaction do
-        CSV::Reader.parse(file) do |row|
+        CSV.parse(file) do |row|
           if line != 0
             product = new_by_array(row, retailer_id)
             if product.nil?