Brian Michel

Joined

1,030 Experience
10 Lessons Completed
0 Questions Solved

Activity

Posted in Nested Comment Threads in Rails - Part 3 Discussion

There is a way to do this... on the show page for posts (or in my case, articles), pull the form into it's own div below and give it an ID like such:
<div id="comments">
<%= render @article.comments.where(parent_id: nil), max_nesting: 4 %>
</div>
<div id="topform">
<%= render partial: "comments/form", locals: { commentable: @article } %>
</div>

Then in your create.js.erb file, target that ID to reset the form in there as well like such:
```var form = comments.parentElement.querySelector("form")
form.reset()

var topform = document.getElementById("topform").querySelector("form")
topform.reset()


Posted in Rails for Beginners Part 19: Edit Password Discussion

Scratch that... no issue. My poor spelling was the problem. Only took 45 minutes to figure that out. :/

Posted in Rails for Beginners Part 19: Edit Password Discussion

I'm having an issue where it does not validate the confirmation to the new password. So no matter if the two are different, it simply updates the password with whatever is in the password field.

logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.