I have three Models: User, Picture, and Like
where:
class Picture
include Mongoid::Document
embeds_many :likes
belongs_to :user
end
class User
include Mongoid::Document
has_many :pictures
has_many :likes
end
class Like
include Mongoid::Document
belongs_to :user
embedded_in :picture
end
No I want to store the likes to then:
- See how many likes have a picture ( Picture.first.likes.count )
- See how many likes a user has ( User.first.likes.count )
- See to what picture the user make a like?
Is this Schema correct to achieve the three requires?