I have a series of chapters. After a person is finished with that chapter I'd like to link them to the next chapter. By finding the next chapter in that specific course.
Currently I let you start at chapter one by doing:
@course.chapters.first
now when you're done reading the first, I'd like to let you go to the 2nd, after that 3rd and so forth. It obviously has to stop when you have no more chapters to read.
I've tried
link_to 'Next Chapter', @chapter.course.chapters.second
which works, but obviously it's not dynamic depending on which chapter you're on. Does anybody know how to fix this?