1
Hello.
I have an app where User
has_many Status
. And Status
has_many Likes
.
How do I get the total amount of Ikes a user has? For example, it has 2 status with 10 Ikes each, which gives a total of 20 Ikes. How I take this amount?
My model is simple:
User has_many Status
Status has_many Likes
Thank you very much, once again Andrey. Just one question: In this case, I could not get how many Ikes the user gave right? Ex: If I put only
user has many likes
and put@user.likes
he would give me all the sent likes. When I use thethrough
he gives me all the received by Status. Would there be any way to get the 2? Maybe name different?– Igor Martins
@Igormartins I edited the question by adding some darlings. That’s what you want?
– user7261