Can someone help me with this nested
# avo-2
i
Can someone help me with this nested form? I'm working with a custom resource tool so I can display child **Message**s of a Chat, similar to a normal text chat UI. At the bottom, I want a nested form that allows one to post a new message. Currently, it updates the Chat succcessfully with no changes to the Messages. The message displays do work with
@resource.model.messages
, but not with creating new ones. Saving it manually with
message = @resource.model.messages.new
->
message.save
does work (after inputting
role
and
content
values). *Things that didn't work*: -
:message
or
:messages
as an argument for
fields_for
- changing the
extra_params
to
message:
(unknown attribute) I'm unsure if it's something I have to change in the resource controller, the
extra_params
, or the model. # resource tool partial
Copy code
ruby
  <% if form.present? %>
  <% form.fields_for @resource.model.messages.new do |message| %>
    <%= form.label :message_content%>
    <%= message.text_field :content, value: 'message name', class: input_classes %>
    <%= message.hidden_field :role, value: 'user' %>
  <% end %>
<% end %>
# Chat Custom Resource
Copy code
ruby
  self.title = :name
  self.includes = [:messages]
  self.extra_params = [messages: [:content, :role]]
  self.model_class = ::Chat
*Would like to have*: - any suggestions on how to enable this form on the Show view so it works as a live chat?
l
hey @incalculable-psychiatrist-85460 can you please open a GitHub isue with this?
could you add a screen recording of what your'e doing and what is not working?