Linking to "Next Entry >>" from the current Entry Page

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?

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 S. [email protected]

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 S. [email protected]

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.

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 S. [email protected]