我确定这是我的课程有问题,但这里是:
class Transaction < ActiveRecord::Base
attr_accessible :transaction_date, :amount, :other_info, :type, :purchase
end
require 'csv'
require_relative '../../app/models/transaction'
csv_text = File.read('monthly_csvs/pcbanking.csv')
csv = CSV.parse(csv_text, :headers => false)
csv.each do |row|
puts row[3].to_s
Transaction.create!(transaction_date: row[0], amount: row[1], other_info: row[2], type: row[3], purchase: row[4])
end
错误:
POS Purchase
rake aborted!
Invalid single-table inheritance type: POS Purchase is not a subclass of Transaction
Pos Purchase 是 row[3] 元素并且是一个字符串。