So i have a Comment
that has a polymorphic association to a commentable
model.
In my routes file i have this
resources :todo_sets do
resources :comments, module: :todo_sets
end
and in my forum i have this
<%= form_for [@commentable, @commentable.comments.new] do |f|%>
<section class="bg-white p-2 w-full my-2 border border--body rounded-lg">
<%= f.rich_text_area :content, placeholder: 'Type your comment here' %>
</section>
<button type="submit" class="text-sm button__green px-3 py-2 rounded-full">Add this comment</button>
<% end %>
when i submit a post response it eventually goes through this controller method
def create
@comment = @commentable.comments.new comment_params
@comment.creator = current_user
@comment.save
respond_to do |format|
format.turbo_stream
end
end
and inside my create.turbo_stream.erb
file i have this
<%= turbo_stream.append "comments", @comment %>
however rails cannot seem to find the partial path of the comment for some reason and i get this error
ActionView::Template::Error (Missing partial todo_sets/comments/_comment with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}. Searched in:
i have my comment _comment
file in this path app/views/comments/_comment.html.erb
.
Any clues on why this happens? thank you