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
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.
Shouldn''t the route that is built be
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---