Is there native support in Rails or Ruby for representing threaded comments -
I have a comment section in my app that looks like this:
response1 Feedback: 1 Response 1B Reaction 1B1 Response 2 Reaction 2 Reaction 2 Reaction 2 Reactions Answer 2 Reactions 1 2 Reactions 1 2 1 2 3 4 1 1 2 3 4 5 1 1 2 3 4 5 6 = "Comment" & gt; ; Response 1 & lt; Div class = "comment" & gt; Response1a & lt; Div class = "comment" & gt; Response1a1 & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "comment" & gt; Response 1b & lt; / Div & gt; & Lt; / Div & gt;
And this CSS:
.comment {margin-left: 50px; }
The data structure is still a question of how to use in railways to represent comments and their relationships with each other. Is there a basic support for Ruby to represent tree data structure, which will work well for this structure of data? Or would I need to adapt something to this task?
You can use one of the nested set plugins - one seems to be most actively retained it happens. These allow you to select a full set (including all descendants) with a call in the database.
Comments
Post a Comment