View inside View

Asked

Viewed 79 times

0

Hello, I’m picking up a code to continue and would like to troubleshoot a problem.

  1. i have a CRUD of clients, and within the views, have the cliente_addressee file...

I went to observe and found that there is also a model, cliente_endereco.Rb...

I would like to implement this part of addresses in the same client CRUD, so I believe the best way is a partial render, like that maybe?

_form.html.erb:

<%= render partial: "customer_address_fields", locals: { customerAddress: @customerAddress }%>

My question is this, how to use the same CRUD and save in another table with another model?

In Controller, in the def create method, I did the following.

@customerAddress = CustomerAddress.new(customer_params)

I’m having trouble creating a form within the address view. I believe you are not loading the view into this code.

<%= form_with(model: customerAddress) do |form| %>

Thank you.

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.