☒ Since the edit link_to isn't a remote: true, you would be rendering a new view. You might be able to render the comment form within there. If you want it to be a bit more of an SPA feel, you could use the remote: true and then that would render the edit.js.erb where you can then render the form partial and display a modal.
If you want to make it load a new page to edit the comment, then you would need to render the form.
☒ You can check out this episode and the Part 1 of it as well. It uses jquery, but the same could be accomplished with vanilla JS if you're using something like Bootstrap 5 Alpha.
Thanks for your video. I have followed it but I got an error on creating a reply. I'm able to create a comment and delete a reply. I get below error header + previous comment when I create a reply. Although when I refresh item show view i see all replies.
NoMethodError at /comments/12/comments
undefined method `comment_url' for #<Comments::CommentsController:0x00000000025e18>
Did you mean? comment_comment_url
☒ It looks like your instance variable commentable got set to a Comment instance instead of an Item. Do you have the app set up for a comment to receive a comment? And when you set the commentable, you should likely be passing in the Item instead of the Comment.
In comments controller I have added:
__________________________________
And in our views _comment.html.erb partial i added in the div 'links'
__________________________________________________________
I am confused what to populate the edit.html.erb file with. Do you have any suggestions?
Thanks
If you want to make it load a new page to edit the comment, then you would need to render the form.
I'm a rookie with javascript and I'm eager to learn it, so I feel obliged to ask...
How would you go about writing the JS to render the form partial and display a modal?
(Great tutorial by the way, I've been teaching myself and this helped me a great deal)
I have followed it but I got an error on creating a reply. I'm able to create a comment and delete a reply.
I get below error header + previous comment when I create a reply. Although when I refresh item show view i see all replies.
Better_errors request info and instance variables
While I followed your video, I have different setup for items:
Thanks