140 Experience
1 Lesson Completed
0 Questions Solved


Posted in Strategy To Track Progress For Completed Nested Lessons

You're welcome, Dale. Glad it helped :)

Posted in Strategy To Track Progress For Completed Nested Lessons

It seems to me that you could break lessons into another discrete model, which then gets a boolean for completion. That would solve your ordinal problem because the percentage completed of Curriculum would just be the total number of those discrete components completed, regardless of where they sit on the tree. The count for Curriculum could also be essentially static, computed only when you update something yourself; that would make the on-the-fly overall calculation less expensive.

I think this would work best in particular if lessons don't need to be completed in a linear fashion.

Posted in How to use Hotwire in Rails Discussion

I hear you. I think iframes were a little more intuitive because the most complicated operation involved targeting in and out of them.

With the cancel link here, it's a bit tricky--for me, anyway--because unlike the CRUD operations, which you can broadcast to from the model (as was done here), what should be a straightforward operation seems to have no real recourse to things like turbo_stream.replace. Calling 'show' means invoking that turbo_frame_tag, whether you want it or not. You could render a partial without it, but then you lose the Turbo functionality for the next operation.

It's probably a conceptual problem, but for me the rather austere docs don't do a great job of wedding streams and frames (to say nothing of linking them with Stimulus).

Posted in How to use Hotwire in Rails Discussion

Have you noticed that every time you click 'Cancel' from edit, it results in a new nested turbo_frame_tag with the same dom id? It doesn't seem to break anything and it's obvious why it's happening, but it still seems weird to me. I was trying to avoid the same behavior in my own project, but things got messy quickly. I can't figure out how you would call 'show' without the corresponding turbo_frame_tag.

Edit for visual:
Edit part 2: To be super clear, the above image is of this project, not mine.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.