mongoid embedded_many com método interno.

Acesso ao objeto base no método interno da relação embedded_many:

class Post
include
Mongoid::Document

field
:author

embeds_many
:comments do
def by_post_author
where(comment_author: @base.author) # access to the post object
end
end