Hi all, I''m trying to link to the "Next Entry >>" from the current entry page (in show.html.erb). Any one know how I would do it? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The best thing would be to set a @next_entry instance variable in the controller so that it''s available to the view. Then you can just link to that directly. The problem with trying to get "next entry" from "current entry" is how that is defined. Is it the next incremental ID? What if some are deleted? Set the logic in the controller so that the view can just "be the view". -Danimal On Apr 16, 4:39 pm, Bob Sanders <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi all, > > I''m trying to link to the "Next Entry >>" from the current entry page > (in show.html.erb). > > Any one know how I would do it? > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bob Sanders
2008-Apr-17 12:20 UTC
Re: Linking to "Next Entry >>" from the current Entry Page
Danimal wrote:> The best thing would be to set a @next_entry instance variable in the > controller so that it''s available to the view. Then you can just link > to that directly. The problem with trying to get "next entry" from > "current entry" is how that is defined. Is it the next incremental ID? > What if some are deleted? Set the logic in the controller so that the > view can just "be the view". > > -Danimal > > On Apr 16, 4:39 pm, Bob Sanders <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Thanks for the suggestion, Danimal! I could see many conflicts with the id linking. I just discovered acts_as_ordered before I saw your post, which is a wonderful little plugin that I''d highly recommend as another option. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Oooh! I just read the README from acts_as_ordered. That''s a pretty slick plugin! And with it, you can toss out my advice above cause you can just say: @entry.next in your link_to Slick! -Danimal On Apr 17, 6:20 am, Bob Sanders <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Danimal wrote: > > The best thing would be to set a @next_entry instance variable in the > > controller so that it''s available to the view. Then you can just link > > to that directly. The problem with trying to get "next entry" from > > "current entry" is how that is defined. Is it the next incremental ID? > > What if some are deleted? Set the logic in the controller so that the > > view can just "be the view". > > > -Danimal > > > On Apr 16, 4:39 pm, Bob Sanders <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > Thanks for the suggestion, Danimal! I could see many conflicts with the > id linking. > > I just discovered acts_as_ordered before I saw your post, which is a > wonderful little plugin that I''d highly recommend as another option. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---