I am working on an application a deep association. A Story belongs to a Planning Level, the Planning Level belongs to one or many Programs.

```
class Program < ActiveRecord::Base
  has_and_belongs_to_many :planning_levels
  has_many :stories, :through => :planning_levels
end

class PlanningLevelsPrograms < ActiveRecord::Base
end

class PlanningLevel < ActiveRecord::Base
  has_and_belongs_to_many :programs
  has_many :stories
end

class Story < ActiveRecord::Base
  belongs_to :planning_level
end

```

Within the Program show page I'd like to display the Program, each Planning Level and aggregate Story count for each Planning Level. 

I'm not sure how to access the Story model from the Program show page.

The following works great for displaying each Planning Level belonging to the Program.

```
<% @program.planning_levels.each do |p| %>
  <p><%= p.name %></p>
<% end %>

```

...but I have no idea how to make the following work for each displayed Planning Level. How do I access the Story model from with the Program? Is there something needed in the Program controller that I'm missing. Thanks in advance!

```
@program.planning_level.stories.count(:id)

```