我在终端上做了rails console来检查模型是否有数据(user.name =" Yuri"& user.email =" odyssey")。然而,终端说
override func viewDidAppear(_ animated: Bool) {
// DOES NOT WORK
var i = 0
for workorder in dm.workOrderNames {
if (workOrderToBeDisplayed == workorder) {
scrollTableTo(section: i, row: 0)
print("workorder = \(workorder) i = \(i)")
return
}
i = i + 1
}
workOrderView.scrollToItem(at:IndexPath(item: i, section: 0), at: .centeredHorizontally, animated: false)
}
func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
// WORKS
workOrderView.scrollToItem(at:IndexPath(item: indexPath.item, section: 0), at: .centeredHorizontally, animated: false)
return true
}
这些平均模型是否没有任何数据? 我是初学者,所以这是我使用终端的错误吗?(在这种情况下,我应该在终端做什么?)
在模特中,我写了
[3] pry(main)> user = User.new
NameError: uninitialized constant User
from (pry):3:in `__pry__'