It seems that the example you gave may be doing something different
that what you describe. I believe the forum_id will be used as a value
in a new topic form, not as a "filter" for a list of topics.
If you wanted to "filter" a list of topics by forum_id you might do
something like the following:
# routes.rb
map.resources :forums do |forums|
forums.resources :topics
end
This would generate routes like forum_topics and new_forum_topic so
you could call the following in your controllers & views:
# some_view.html.erb
<%= link_to "click here to see #{@my_forum.name} topics",
forum_topics_path(@my_forum) %>
This would result in a link to /forums/7/topics where @my_forum's id
is 7.
For a complete list of routes you've defined try this in your command
line:
$ rake routes
When GETing the path above, your topics_controller index action will
be called. In that method you'll need to look for params[:forum_id]
when finding your list of topics for the desired forum:
# topics_controller
def index
if params[:forum_id]
#find topics belonging to a specified forum
@forum = Forum.find(params[:forum_id])
@topics = @forum.topics
else
# find all topics
@topics = Topic.find(:all)
end
...
end