最初我以数据类型Hash导入数据,因为我有一个名为 schedule 的列,我需要我的数据库中特定列“schedule”的类型。我尝试过的代码是
schedule = scheduleWorld.all
schedule.each do |sec|
sec.attributes.each do |key, value, type|
puts "%%%%%%%%%%%%%%%%%%%%%%%%%"
puts key
puts value
puts type
puts "%%%%%%%%%%%%%%%%%%%%%%%%%"
end
end
这样我的类型就为零了,我尝试了另一个代码是
schedule = scheduleWorld.where({schedule:{$type=>2}})
错误是
undefined method `specify' for nil:NilClass
(eval):2:in `where'
有人知道吗?