incalculable-psychiatrist-85460
06/09/2023, 10:13 PM@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
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
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?lemon-wall-20836
06/11/2023, 4:59 PMlemon-wall-20836
06/11/2023, 5:00 PM