Question

I'm planning a new rails apps for teaching lessons. Each lesson will belong to a track (e.g. Level I). So each track has_many lessons.

But each lesson should have a Lesson Number within each track. What is a good way to present the lessons in sequential order (e.g. Lesson 4, Track 2).

I'm not sure exactly how to assign lesson numbers within the tracks and keep them in sequential order. If they didn't have to be organized into tracks then I could just use created_at to put them into sequential order.

Is the lesson number something that the user creating the lesson needs to assign manually when they create or update a lesson?

Anyone have opinions on a good way to do this?

Was it helpful?

Solution

I would have an extra column, e.g. position (or similar), in the lesson/track tables if you want your users to have control over what the lesson/track numbers are, as opposed to just having them in sequential order by creation date.

You can do that either by giving the lesson creator a field to enter the lesson number, or some sort of UI sortable interface they can use to organize the order. When displaying the lessons/tracks you'd probably want to order by the position field.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top