'How to get all embeds_many items in Mongoid
I'm Using Mongoid and I have two models:
class User
include Mongoid::Document
include Mongoid::Timestamps
embeds_many :tickets
field :email, type: String
end
class Ticket
include Mongoid::Document
include Mongoid::Timestamps
embedded_in :user
field :body, type: String
end
How can I do get all records from Ticket for any users?
When I use Ticket.all, I get nil.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
