Rails - count query while joining three tables to one?

I think you'd get the best results by adding a cache column on User, let's call it :last_activity_at, then update this with an after_create callback on Submission, Comment and Vote. Class Submission? ', current_user.

Last_refresh_date).

I then re-iterate this built-up array while comparing the dates to determine if the count should be incremented. Not the most ideal solution. I wish to add yet one more count to the present query.

I need to count all new comments & votes on the current_user. Submissions that are not part of the original count (ie. Not a friend).

Join(:comments, :votes, :friends). I can't quite get the query correct (new to complex queries via active record). I was going to make it a separate query and then add it to the original count.

Can it be absorbed into one query instead of two?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions