gpt4 book ai didi

ruby-on-rails - Mongoid Object.all 似乎返回了很多 []

转载 作者:IT老高 更新时间:2023-10-28 13:31:27 25 4
gpt4 key购买 nike

为什么这不起作用:

ruby-1.8.7-p249 > List.create :search_terms => 'foo'
=> #<List _id: 4c9044a02249c7a5e2000001, search_terms: "foo", user_id: nil>

ruby-1.8.7-p249 > List.all
=> #<Mongoid::Criteria:0x1030dea90 @klass=List, @documents=[], @selector={}, @options={}>

ruby-1.8.7-p249 > List.all.documents
=> []

最佳答案

我认为您正在寻找的是:

List.all.to_a

关于ruby-on-rails - Mongoid Object.all 似乎返回了很多 [],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3714575/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com