Hello, I''m having a problem with paginating_find losing the context of the array it''s paginating. For example, URL: http://localhost:3000/companies/1/users/1 <% @tickets = @user.tickets.find(:all, page => {:size => 10, :current => params[:page]}) %> <% for ticket in @tickets %> ... <% end %> <%= paginating_links (@tickets) %> The problem is ''paginating_links'' is spitting out pagination URLs that look like: http://localhost:3000/users/1?page=2 instead of: http://localhost:3000/companies/1/users/1?page=2 Any ideas why it''s losing the context of the company? Thank you! -scott --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I figured out what is making this happen. I have a routes file that contains: map.resources :users, :has_many => [:tickets] map.resources :companies, :has_many => [:users] Is the paginating_links method simply finding the first route? Any way to tell it the correct route/path? Thanks, -scott On Dec 8, 6:29 pm, Scott <g...-BUHhN+a2lJ4@public.gmane.org> wrote:> Hello, > > I''m having a problem with paginating_find losing the context of the > array it''s paginating. > > For example, > > URL: http://localhost:3000/companies/1/users/1 > > <% @tickets = @user.tickets.find(:all, page => {:size => > 10, :current => params[:page]}) %> > <% for ticket in @tickets %> > ... > <% end %> > <%= paginating_links (@tickets) %> > > The problem is ''paginating_links'' is spitting out pagination URLs that > look like: > > http://localhost:3000/users/1?page=2 > > instead of: > > http://localhost:3000/companies/1/users/1?page=2 > > Any ideas why it''s losing the context of the company? > > Thank you! > > -scott--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Problem solved: <%= paginating_links(@tickets, {:params => {:controller => "companies/#{@company.id}/users/#{@user.id}/"}, :window_size => 10}) %> Thanks for the hint Alex! On Dec 8, 9:20 pm, Scott <g...-BUHhN+a2lJ4@public.gmane.org> wrote:> I figured out what is making this happen. I have a routes file that > contains: > > map.resources :users, :has_many => [:tickets] > map.resources :companies, :has_many => [:users] > > Is the paginating_links method simply finding the first route? Any > way to tell it the correct route/path? > > Thanks, > > -scott > > On Dec 8, 6:29 pm, Scott <g...-BUHhN+a2lJ4@public.gmane.org> wrote: > > > Hello, > > > I''m having a problem with paginating_find losing the context of the > > array it''s paginating. > > > For example, > > > URL: http://localhost:3000/companies/1/users/1 > > > <% @tickets = @user.tickets.find(:all, page => {:size => > > 10, :current => params[:page]}) %> > > <% for ticket in @tickets %> > > ... > > <% end %> > > <%= paginating_links (@tickets) %> > > > The problem is ''paginating_links'' is spitting out pagination URLs that > > look like: > > > http://localhost:3000/users/1?page=2 > > > instead of: > > > http://localhost:3000/companies/1/users/1?page=2 > > > Any ideas why it''s losing the context of the company? > > > Thank you! > > > -scott--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---