0
레일스에 주가 기록에 대한 모델이 있습니다.이 데이터를 야후 파이낸싱 API에서 내 모델로 대량 가져 오기하고 싶습니다.정의되지 않은 메소드 each_with_index activerecord-import
이 내가 가진 무엇 :
말하는 오류가 발생columns = [:date,:open,:high,:low,:close,:volume,:adjusted_close,:asset_symbol]
values = ['2013-03-22',1,2,3,4,5,6,'YHOO']
AssetHistory.import columns,values
: 내 값 배열의 날짜가 내 모델에서 실제로 종류의 일이다 undefined method each_with_index for '2013-03-22':String from .../activerecord-import/import.rb
하는 것으로. (그게 문제니까?)
Active Record-Import 0.3.1 및 Rails 3.2를 사용하고 있습니다. 또한 중요한 경우 Postgresql을 사용하고 있습니다. 주석과
내 자산 역사 모델 :
# Table name: asset_histories
#
# id :integer not null, primary key
# date :date
# open :float
# high :float
# low :float
# close :float
# volume :integer
# adjusted_close :float
# asset_symbol :string(255)
# asset_id :integer
#
class AssetHistory < ActiveRecord::Base
attr_accessible :adjusted_close, :close, :date, :high, :low, :open, :volume, :asset_id, :asset_symbol
has_and_belongs_to_many :assets
validates_uniqueness_of :asset_symbol, scope: [:date]
end
이 문제가 무엇인지 어떤 이유?