N+1 functionality implemented to optimize sql queries & all_posts_by_author page & query implemented