开发者

Mongoid Object.all seems to return a lot of []

开发者 https://www.devze.com 2023-01-16 08:44 出处:网络
Why doesn\'t this work: ruby-1.8.7-p249 > List.create :search_terms => \'foo\' => #<Li开发者_运维问答st _id: 4c9044a02249c7a5e2000001, search_terms: \"foo\", user_id: nil>

Why doesn't this work:

ruby-1.8.7-p249 > List.create :search_terms => 'foo'
 => #<Li开发者_运维问答st _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
 => [] 


I think what you're looking for is:

List.all.to_a
0

精彩评论

暂无评论...
验证码 换一张
取 消