# Pagination is ignoring my RESTful routes?

**URL:** <https://www.ruby-forum.com/t/pagination-is-ignoring-my-restful-routes/106245>\
**Category:** Rails\
**Created:** [June 7, 2007, 8:29pm UTC](https://www.ruby-forum.com/t/pagination-is-ignoring-my-restful-routes/106245 "2007-06-07T20:29:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bravedave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/46a35a/32.png) [@bravedave](https://www.ruby-forum.com/u/bravedave)\
**Post date:** [June 7, 2007, 8:29pm UTC](https://www.ruby-forum.com/t/pagination-is-ignoring-my-restful-routes/106245/1 "2007-06-07T20:29:17Z")

</div>

My routes for parent = project and child = portal looks like this:  
map.resources :projects do |projects|  
projects.resources :portals, :name\_prefix =\> “project\_”  
end

In my portals=index I have the following Pagination code that’s always  
worked for me.  
@portal\_pages = Paginator.new self, @project.portals.count, 3,  
params[:page]  
@portals = @project.portals.find :all,  
:order =\> ‘description’,  
:limit =\> @portal\_pages.items\_per\_page,  
:offset =\> @portal\_pages.current.offset

The code at the bottom of the portal.index view is  
\<%= link\_to ‘Previous page’, { :page =\>  
@portal\_pages.current.previous } if @portal\_pages.current.previous %\>  
\<%= link\_to ‘Next page’, { :page =\> @portal\_pages.current.next } if  
@portal\_pages.current.next %\>

My index view displays the first page correctly displaying this route:  
[http://localhost:3005/projects/1/portals](http://localhost:3005/projects/1/portals)  
When I click the NEXT button a NON-nested route is called that  
‘coughs’ as the parent PROJECT.id is nowhere to be found (as shown)  
[http://localhost:3005/portals?page=2](http://localhost:3005/portals?page=2).

Shouldn’t the route that is built be  
[http://localhost:3005/projects/1/portals?page=2](http://localhost:3005/projects/1/portals?page=2).  
The error displayed = Error = ActiveRecord::RecordNotFound in  
PortalsController#index  
Couldn’t find Project without an ID  
Is there a special Paginator object for nested RESTful routes?  
Thanks,  
David
