I am trying to track down where the pagination_links are calculated. I have integrated SB into my site, and the show.rhtml for the topics controller references them like this: <p class="pages"><%= _(''Pages:'') %> <strong><%= pagination_links @post_pages, :window_size => 10 %></strong></p> The problem is, the pagination_links are being built wrong. They are missing the forums id in the url and are defaulting to: ../topics/9? page=2 notice there is not a "forums" part to that URL. The URL should be .../forums/6/topics/9?page=2. Right now, this produced a Action Controller exception: Couldn''t find Forum without an ID. It all makes sense ... now I just need to find where I can change how "pagination_links" are built. This must be a standard problem .... unless I''ve mucked up my environment too much without realizing it?? Thanks in advance! LAB --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jodi Showers
2007-Sep-26 01:15 UTC
Re: Savage Beast: where are the pagination_links calculated?
I don''t have the source in front of me - but I''d look for the helper "pagination_links", and modify it to take a forum_id param. Looking at the source for the helper should give you what you need- You''ll also need to over-ride the view. If you find a solution I''ll commit the fix. Cheers, Jodi On 25-Sep-07, at 8:55 PM, LAB wrote:> > I am trying to track down where the pagination_links are calculated. > I have integrated SB into my site, and the show.rhtml for the topics > controller references them like this: > > <p class="pages"><%= _(''Pages:'') %> <strong><%= pagination_links > @post_pages, :window_size => 10 %></strong></p> > > The problem is, the pagination_links are being built wrong. They are > missing the forums id in the url and are defaulting to: ../topics/9? > page=2 notice there is not a "forums" part to that URL. The URL > should be .../forums/6/topics/9?page=2. > > Right now, this produced a Action Controller exception: Couldn''t find > Forum without an ID. > > It all makes sense ... now I just need to find where I can change how > "pagination_links" are built. > > This must be a standard problem .... unless I''ve mucked up my > environment too much without realizing it?? > > Thanks in advance! > LAB > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jodi Showers
2007-Sep-26 01:29 UTC
Re: Savage Beast: where are the pagination_links calculated?
I (so) forgot that pagination_links was built in... http://api.rubyonrails.org/classes/ActionView/Helpers/ PaginationHelper.html#M000504 the other way to manage this, would be to override find_forum_and_topic to guess the form id given a specific topic id something like: def find_forum_and_topic if params[:id] && !params[:form_id] @topic = Topic.find(params[:id]) @form = @topic.forum end ... end Take a look at the base beast topic controller find_forum_and_topic before_filter for guidance. cheers, Jodi On 25-Sep-07, at 8:55 PM, LAB wrote:> > I am trying to track down where the pagination_links are calculated. > I have integrated SB into my site, and the show.rhtml for the topics > controller references them like this: > > <p class="pages"><%= _(''Pages:'') %> <strong><%= pagination_links > @post_pages, :window_size => 10 %></strong></p> > > The problem is, the pagination_links are being built wrong. They are > missing the forums id in the url and are defaulting to: ../topics/9? > page=2 notice there is not a "forums" part to that URL. The URL > should be .../forums/6/topics/9?page=2. > > Right now, this produced a Action Controller exception: Couldn''t find > Forum without an ID. > > It all makes sense ... now I just need to find where I can change how > "pagination_links" are built. > > This must be a standard problem .... unless I''ve mucked up my > environment too much without realizing it?? > > Thanks in advance! > LAB > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ahhhhh ... that''s why I couldn''t find pagination_links in any of my SB helper files. I added your puedo code to my topic controller and it worked great!!! For others ... very specifically: def find_forum_and_topic if params[:id] && !params[:forum_id] @topic = Topic.find(params[:id]) @forum = @topic.forum_id else @forum = Forum.find(params[:forum_id]) @topic = @forum.topics.find(params[:id]) if params[:id] end end Thanks for the work around!! Cheers! LAB On Sep 25, 9:29 pm, Jodi Showers <j...-BOB1p6JRLoAV+D8aMU/kSg@public.gmane.org> wrote:> I (so) forgot that pagination_links was built in... > > http://api.rubyonrails.org/classes/ActionView/Helpers/ > PaginationHelper.html#M000504 > > the other way to manage this, would be to override > find_forum_and_topic to guess the form id given a specific topic id > > something like: > > def find_forum_and_topic > if params[:id] && !params[:form_id] > @topic = Topic.find(params[:id]) > @form = @topic.forum > end > ... > end > > Take a look at the base beast topic controller find_forum_and_topic > before_filter for guidance. > > cheers, > Jodi > > On 25-Sep-07, at 8:55 PM, LAB wrote: > > > > > I am trying to track down where the pagination_links are calculated. > > I have integrated SB into my site, and the show.rhtml for the topics > > controller references them like this: > > > <p class="pages"><%= _(''Pages:'') %> <strong><%= pagination_links > > @post_pages, :window_size => 10 %></strong></p> > > > The problem is, the pagination_links are being built wrong. They are > > missing the forums id in the url and are defaulting to: ../topics/9? > > page=2 notice there is not a "forums" part to that URL. The URL > > should be .../forums/6/topics/9?page=2. > > > Right now, this produced a Action Controller exception: Couldn''t find > > Forum without an ID. > > > It all makes sense ... now I just need to find where I can change how > > "pagination_links" are built. > > > This must be a standard problem .... unless I''ve mucked up my > > environment too much without realizing it?? > > > Thanks in advance! > > LAB--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---