I have a thread Model that has many `Posts`, and each post has an author (User)

```
class Thread < ActiveRecord::Base
    has_many :posts
end

class Post < ActiveRecord::Base
    belongs_to :thread
    belongs_to :user
end

```

In my Thread controller `show` action + view I want to iterate through all the posts of that particular thread and access information about the user.

```
controller:
@thread = Thread.find(params[:id])

view
thread.posts.each do |p|
   if p.user.first_name = '....'

   end
end    

```

What's happening at the moment is it's doing a query to find the correct `Thread`, one query to find all of the `Posts` and then for each post is it doing:

```
SELECT "users".* FROM "users" WHERE "users"."id" = x

```

Even if the same user makes 10 posts, it will still be called 10 times for a particular user.

Is there some way to use `includes` or `eager_load` to avoid the repetition of this query?