You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was going to post this on StackOverflow but since it's rather specific to this gem, I thought I'd ask here first. Hopefully that's ok. I have closure_tree working quite nicely for a comments system. If I go to a status, all comments on that status will show and that part works great. If I go to the news feed, I show 10 statuses at a time, and then it calls hash_tree 10 times which means 10 database hits.
Is it possible using joins and includes to move this into my initial query for statuses? Something like:
@statuses = Status.where('something here').joins('sql for closure_tree).includes(:comments)
If it is possible I can work out what code I need to do it, I'm just not sure if it's possible. The end result is I'm wanting to call status.comments.hash_tree, or something similar, and have it via the collection.
The text was updated successfully, but these errors were encountered:
I was going to post this on StackOverflow but since it's rather specific to this gem, I thought I'd ask here first. Hopefully that's ok. I have closure_tree working quite nicely for a comments system. If I go to a status, all comments on that status will show and that part works great. If I go to the news feed, I show 10 statuses at a time, and then it calls hash_tree 10 times which means 10 database hits.
Is it possible using joins and includes to move this into my initial query for statuses? Something like:
@statuses = Status.where('something here').joins('sql for closure_tree).includes(:comments)
If it is possible I can work out what code I need to do it, I'm just not sure if it's possible. The end result is I'm wanting to call status.comments.hash_tree, or something similar, and have it via the collection.
The text was updated successfully, but these errors were encountered: