How would one 'build' embedded documents in mongoid?
Trying to create embedded documents for a collection. However, I am
finding this approach a bit inefficient and long-coming. Is there a better
way to do something like:
@stat.dates.find_or_create_by(date:
20130904).users.find_or_create_by(status:
'signed_in').update_attributes(count: 1234)
I am aware there is an autobuild directive. But this only applies for
embeds_one and has_one associations.
Any other approaches?
No comments:
Post a Comment